Mappolyline in WP8 from XAML not working?

everything that I work with WP 8 is the new Maps from Nokia. Having a small problem with mappolyline from xaml, it will not be displayed. Tried (Some initialization code has been deleted): Where Coords is just a public property of type GeoCoordinateCollection I can show the polygon by executing the code, but this is not what I want now that I learned about binding the code to templates, etc.

<maps:Map x:Name="Map" Grid.Row="1" > <maps:Map.MapElements > <maps:MapPolyline StrokeColor="red" StrokeThickness="2" Path="{Binding Coords}"></maps:MapPolyline> </maps:Map.MapElements> </maps:Map> 
+7
source share
1 answer

Try adding a polyline through the code,

  var _polyline = new MapPolyline(); line.StrokeColor = Colors.Red; line.StrokeThickness = 2; line.Path.Add(new GeoCoordinate(lat,long)); line.Path.Add(new GeoCoordinate(lat, long)); MyMap.MapElements.Add(line); 
0
source

All Articles