Reputation: 98
I have a Windows.UI.Xaml.Shape.Path object.How can l generate the xaml string corresponding to that Path object.
Input : Path object
Desired Output : "Path Data="M 120,10 200,L300" Stroke="Black"""
or is there any way to calculate Path Data from Path Bounds property?
Upvotes: 2
Views: 1448
Reputation: 2151
try this
string s_output = System.Windows.Markup.XamlWriter.Save(yourpath);
and to reload use
System.IO.StringReader stringReader = new System.IO.StringReader(s_output);
System.Xml.XmlReader xmlReader = System.Xml.XmlTextReader.Create(stringReader, new System.Xml.XmlReaderSettings());
Path yourpath= (Path)System.Windows.Markup.XamlReader.Load(xmlReader);
Upvotes: 3