There's nothing built-in to generate C# or VB code from the geometry minilanguage, but you could create one as follows:
- Emit C# or VB code for new-ing up a PathGeometry.
- Call
PathFigureCollection.Parse
on your path string. This will return a PathFigureCollection
instance.
- Iterate over the PathFigureCollection. For each figure:
- Write out C# or VB code for new-ing a PathFigure object and adding it to the PathGeometry.Figures collection.
- Iterate over the figure's Segments collection. For each segment, analyse its type and emit type-dependent code for new-ing up the appropriate kind of PathSegment, setting its properties and adding it to the current PathFigure.
Whether this is more or less tedious than converting the paths by hand is something only you can decide, though... it probably depends on how many different kinds of segment you need to handle (i.e. how many different kinds of segment appear in your path strings), since you will have to write separate code for LineSegments, ArcSegments, etc.
EDIT: Thanks to Anvaka in comments for simplifying the original answer by drawing my attention to PathFigureCollection.Parse.