I am looking for a way to be able to use the wpf Path element to draw a path that will represent a route on the map. I have the Route class that contains a collection of vertices and would like to use it for binding. I don't really know how to even start.. Any hints?
相关问题
- VNC control for WPF application
- Highlight parent path to the root
- How do I bind a DataGridViewComboBoxColumn to a pr
- WPF Binding from System.Windows.SystemParameters.P
- Xamarin. The name 'authorEntry does not exist
The main thing you'll need for the binding is a converter that turns your points into
Geometry
which the path will need asData
, here is what my one-way converter from aSystem.Windows.Point
-array to Geometry looks like:Now all that is really left is to create an instance of it and use it as the converter for the binding. What it might look like in XAML:
If you need the binding to update automatically you should work with dependency properties or interfaces like
INotifyPropertyChanged
/INotifyCollectionChanged
Hope that helps :D
Also you can try it this way:
Then in the resource create a
PathString
then bind it this way: