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?
相关问题
- VNC control for WPF application
- WPF Binding from System.Windows.SystemParameters.P
- Xamarin. The name 'authorEntry does not exist
- XAML: Applying styles to nested controls
- How can I add a horizontal line (“goal line”) for
Edit: Looking at this just now i thought that there should be a class called
GeometryConverter
which should be able to do this, and indeed there is. Just create one of those and useConvertToString
on the geometry you want to convert.You can use the
XamlWriter
class 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
PathGeometry
is now in mini-language. If you want to use this right away in your application i suppose you could write it to aMemoryStream
and get the data from it by creating aXmlDocument
from it.