WPF, convert Path.DataProperty to Segment objects

Posted by user275587 on Stack Overflow See other posts from Stack Overflow or by user275587
Published on 2010-03-12T21:31:11Z Indexed on 2010/03/12 21:57 UTC
Read the original article Hit count: 180

Filed under:
|
|
|
|

I was wondering if there was a tool to convert a path data like "M 0 0 l 10 10" to it's equivalent line/curve segment code.

Currently I'm using:

string pathXaml = "<Path xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" Data=\"M 0 0 l 10 10\"/>";
Path path = (Path)System.Windows.Markup.XamlReader.Load(pathXaml);

It appears to me that calling XamlParser is much slower than explicitly creating the line segments. However converting a lot of paths by hand is very tedious.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about path