It’s not too hard to track down how to programmatically convert path strings into path objects in WPF, but is there a built-in function to convert a geometry or path back to a string in the mini-language?
It’s not too hard to track down how to programmatically convert path strings into
Share
Edit: Looking at this just now i thought that there should be a class called
GeometryConverterwhich should be able to do this, and indeed there is. Just create one of those and useConvertToStringon the geometry you want to convert.You can use the
XamlWriterclass to output objects as XAML, geometry will automatically be reduced to the mini-language.e.g. if this is your input:
…and you serialize it…
…you get the following:
All the
PathGeometryis now in mini-language. If you want to use this right away in your application i suppose you could write it to aMemoryStreamand get the data from it by creating aXmlDocumentfrom it.