How to serialize WPF drawing?

I may have missed something.

I figured WPF drawn vector drawings (like DrawingGroup, DrawingGeometry, etc.) were ready to be serialized. But this is not the case. So, should I traverse all these drawing children and store their points, lines, brushes (which are also not serializable), etc., and then do my own serialization?

Is it really difficult or am I missing something pretty obvious?

I mean even serializing Bitmap images is easy. I think serialization of vector drawings was easier (no loss of quality, just descriptive information, massive data).

Thanks for your practical answers, alternative suggestions and comments!

+2


a source to share


2 answers


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



+4


a source


It's just an idea: how about serializing it as a byte array?



0


a source







All Articles