I am trying to change the fill color of some MapPolyline
with a binding. In my XAML code I have
<m:Map x:Name="myMap"
CredentialsProvider="XXXXX"
Mode="Road">
<m:MapItemsControl ItemsSource="{Binding Devices}">
<m:MapItemsControl.ItemTemplate>
<DataTemplate>
<m:MapPolyline Locations="{Binding Locations}"
Fill="{Binding Path=Fill}"
Stroke="Blue"
StrokeThickness="4"
Opacity="1"/>
</DataTemplate>
</m:MapItemsControl.ItemTemplate>
</m:MapItemsControl>
</m:Map>
When I try to run the program I get the error A 'Binding' cannot be set on the 'Fill' property of type 'MapPolyline'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.
While searching I found this answer, which makes me think that I cannot do this, because of the way the MapPolyline control is defined. I tired to dig into the MapPolyline control and it seems that Fill
is a PropertyPath
, not a DependencyProperty
.
Am I correct? Is there any other way that I can change the Fill
property either with a binding or with some code?