This project has moved. For the latest updates, please go here.

Binding to MapPolyline Stroke

Mar 1, 2013 at 11:24 AM
Edited Mar 1, 2013 at 11:24 AM
Hi Clemens

Having some trouble binding a property to the 'Stroke' property of the MapPolyLine.

I have my Polyline:
<map:MapPolyline Name="polyz" Canvas.ZIndex="0" Locations ="{Binding Locations}" Stroke="{Binding Backgroundb}" StrokeThickness="5"/>
And in my ViewModel:
        private Brush _backgroundb;
        public Brush Backgroundb
        {
            get
            {
                return _backgroundb;
            }

            set
            {
                _backgroundb = value;
                OnPropertyChanged("Backgroundb");
            }
        }

        public MapViewModel()
        {
            Backgroundb = new SolidColorBrush(Colors.Yellow);
        }
But the polyline isn't drawn on the map, and if I try and interact with the collection I get the error:
Cannot resolve all property references in the property path 'Stroke.Color'. Verify that applicable objects support the properties.
Any ideas?
Thanks!
Mar 1, 2013 at 12:44 PM
Coordinator
Mar 1, 2013 at 1:06 PM
Don't know what I can do here. MapPolyline is a standard WPF Shape (or a Path in Silverlight/WinRT). There is no code in MapPolyline that deals with its Stroke property.
Mar 1, 2013 at 2:41 PM
Thanks Clemens

Another quick question - is it possible to disable clicking a Pushpin? I've set it to IsEnabled="False", but I'm still selecting them when clicking around my map and their opacity is 0.

Thanks again
Coordinator
Mar 1, 2013 at 4:18 PM
You may set IsHitTestVisible="False".

Please also note that I made a new release today, which may solve issues with initially invisible MapPolylines in the WPF version.