There is nothing built in to generate C # or VB code from a minimal geometry language, but you can create it like this:
- Modify the C # or VB code to create a PathGeometry.
- Call
PathFigureCollection.Parse in the path string. This will return an instance of PathFigureCollection . - Iterate over a PathFigureCollection. For each digit:
- Write the C # or VB code for the new PathFigure object and add it to the PathGeometry.Figures collection.
- Iterating over a collection of segments. For each segment, analyze its type and emit type-specific code to create the appropriate PathSegment type, set its properties and add it to the current PathFigure.
Whether this is more or less tedious than converting paths manually, this is something you can decide though ... it probably depends on how many different segments you need to process (i.e. how many different kinds of segments appear in your path lines), since you have to write separate code for LineSegments, ArcSegments, etc.
EDIT: Thanks to Anwaka in the comments for simplifying the original answer by drawing my attention to PathFigureCollection.Parse.
source share