Questions tagged [xamlwriter]

20 questions
8
votes
2 answers

TFS 2010: Why is it not possible to deserialize a Dictionary with XamlWriter.Save when I can use XamlReader for deserializing

public static string GetXml(Dictionary parameters) { return XamlWriter.Save(parameters); } The above statement returns a NotSupportedException. The strange thing is that I can use the XamlReader to serialize a dictionary. public…
Rookian
  • 19,841
  • 28
  • 110
  • 180
8
votes
2 answers

Insert contents from the one FlowDocument into another when using XamlReader and XamlWriter

I use FlowDocument with BlockUIContainer and InlineUIContainer elements containing (or as base classes) some custom blocks - SVG, math formulas etc. Because of that using Selection.Load(stream, DataFormats.XamlPackage) wont work as the serialization…
too
  • 3,009
  • 4
  • 37
  • 51
5
votes
2 answers

How to prevent XamlWriter.Save from serializing the BaseUri property?

I'm making a theme editor for a WPF application. I generate XAML files dynamically, then I compile them into a DLL that is used by the application. The code used to generate the XAML files goes along those lines: var dictionary = new…
Thomas Levesque
  • 286,951
  • 70
  • 623
  • 758
5
votes
2 answers

XamlWriter.Save() is not serializing DependencyProperties

Consider the following XAML from my UserControl: And the associated event handler: private void TextBlock_OnLoaded(object sender, RoutedEventArgs e) { var xaml =…
bugged87
  • 3,026
  • 2
  • 26
  • 42
3
votes
2 answers

Saving arrays with XamlWriter

I am trying to save a collection of objects with XamlWriter in the simplest way possible. For some reason saving them as an array produces invalid XML: var array = new int[] {1, 2, 3}; Console.Write(XamlWriter.Save(array)); outputs:
GazTheDestroyer
  • 20,722
  • 9
  • 70
  • 103
3
votes
2 answers

Creating FlowDocument on BackgroundWorker thread

I have the need to generate dynamically generate a FlowDocument from a large set of data. Because the process takes several minutes, I'd like to perform the operation on a background thread rather than have the UI hang. However, I can't generate the…
JamesPD
  • 620
  • 2
  • 8
  • 22
2
votes
1 answer

XamlWriter.Save(object) - set root & additional namespaces

I'm serializing a object via XamlWriter.Save(object). This works as expected. Problem now is, XamlWriter sets the namespaces as it needs, for example the root Namespace xmlns is set to the namespace of my object. Problem is, I want to copy the xaml…
Jochen Kühner
  • 1,385
  • 2
  • 18
  • 43
2
votes
2 answers

Is it possible to get XamlWriter to save a StaticResource?

My problem is shown in the following program, where the GeometryModel3D's Material is set from a StaticResource in XAML. Is it possible to get the XamlWriter to save out the actual StaticResources instead of the resolved references (which it does…
Kevin Marshall
  • 301
  • 3
  • 8
2
votes
1 answer

How to persist an Image with size, location, and rotation and then restore it?

In WPF, I have an image that is dropped onto an InkCanvas and added as a child: ImageInfo image_Info = e.Data.GetData(typeof(ImageInfo)) as ImageInfo; if (image_Info != null) { Image image = new Image(); …
Alan Wayne
  • 5,122
  • 10
  • 52
  • 95
2
votes
0 answers

How can I replace the default XamlWriter in XpsDocumentWriter?

It's a known issue that XamlWriter.Save is very slow (just Google "xamlwriter slow"). The application I wrote generates XPS documents, and has a limited scope of elements that it uses. Thus, I'd like to replace the XamlWriter with a more efficient…
Charlie
  • 846
  • 7
  • 21
1
vote
0 answers

WPF: XamlWriter.Save saves "Run" inlines differently - with tags and without (as simple text)

Textblock have 3 run inlines. I need to save it to xml, and I use XamlWriter.Save for that, as the result I got this:
Choufler
  • 460
  • 5
  • 7
1
vote
1 answer

clone Xaml FramworkElement in WinRT

i need to clone a FrameworkELement in my CodeBehind in WinRT... I did found a solution in the internet, though this workaround doesn't work in WinRT because the XamlWriter is NOT available in winRT! Is there an easy/built-in way to get an exact copy…
JuHwon
  • 2,033
  • 2
  • 34
  • 54
1
vote
1 answer

Simple XAML viewer in WPF

I need to write XAML of a WPF control to string. I used XamlWriter.Save(). It works good. Also I need to format, indent and show the string in a editor (read only) like VS Xaml code view. I dont know how to do this. Please share your valuable…
WPF Lover
  • 299
  • 6
  • 16
0
votes
1 answer

Why does XamlWriter adds a {} to some attributes?

I'm saving a resource dictionary to Xaml using XamlWriter and I noticed that for string properties with just {p}, the XamlWriter adds a {} before the text (resulting in {}{p}). Why does that happen? Is there any way to prevent this? Or at least to…
Nicke Manarin
  • 3,026
  • 4
  • 37
  • 79
0
votes
0 answers

How to convert an SoftwareBitmap Image to cv::Mat Image?

I am referencing this link -> Converting a SoftwareBitmap or WriteableBitmap to cv::Mat in c++/cx But every time I try to put this into the code it shows me this error...enter image description here You can see the background highlighted part..…
SK002
  • 1
  • 1
1
2