views:

239

answers:

2

Hi, maybe I'm missing something.

I believed that WPF vector-based Drawings (like DrawingGroup, DrawingGeometry, etc.) were ready to be serialized. But they are not. So, should I navigate all these drawing childrens, and store they points, lines, brushes (that also are not serializable) and so on, and then made my custom serialization?

Is really that difficult or I'm missing something pretty obvious?

I mean, even serializing Bitmap images is easy. I thinked serializing vector-based drawings were easier (no quality loss, just descriptive info, no massive data).

Thanks for your practical answers, alternate-way suggestions and comments!

A: 

This is just an idea: What about serializing it as a byte array?

JYelton
That is exactly the .NET native binary serialization that Drawing images doesn't implement by default.
Néstor Sánchez A.
+2  A: 

You can use the XamlWriter.Save method to save the drawing as XAML

Thomas Levesque
Yeah! That XAML serialization saved my day.I had to convert to byte-array and compress it to save space.Thanks!Plus, i put an MS-Connect suggestion about this...https://connect.microsoft.com/VisualStudio/feedback/details/559114/make-drawing-brush-and-other-wpf-classes-serializable
Néstor Sánchez A.