Hello,
I have several GeographicPolylineSeries objects which I want to plot on a XamGeographic map, but I need to be able to set the color of each series programmatically.
I was hoping to do something like this:
Style style = new Style();
style.Setters.Add(new Setter(GeographicPolylineSeries.BrushProperty, Brushes.Red));
...
GeographicPolylineSeries polySeries = new GeographicPolylineSeries();
polySeries.ShapeStyle = style;
DataMap.Series.Add(polySeries);
This obviously does not work. Through XAML, I've been able to "hard-code" a series color using the "Stroke" property, but I don't see where that property is exposed anywhere as a dependency property to supply to the style's setters object. Is there something I'm missing or some other preferred method for doing this?
Thanks, Steve
Never mind that last post. I found the Path in System.Windows.Shapes namespace.
Thanks for the help!
Setting the Outline property of the polySeries object works great.
If I want to use the style like you have in the second example, what namespace does the "Path" object exist in? I can't seem to find it.
Thanks,
Steve
Hi Steve,
The easiest way to set the color of the GeographicPolylineSeries is to set its Outline property:
polySeries.Outline = Brushes.Red;
You can use also the ShapeStyle but the style target type should be Path, not GeographicPolylineSeries since Paths are used to draw the shapes of the series. Here is the code:
style.Setters.Add(new Setter(Path.StrokeProperty, Brushes.Red));
Diyan Dimitrov