我想在我的地图中使用MapPolyLine来显示实时路线,希望它会移动/缩放this time。事情是在地图上之所以未行了,我找不到任何编程错误:MapPolyline未绘制
C#
MapLayer pathLayer;
//Constructor
pathLayer = new MapLayer();
MapPolyline line = new MapPolyline();
line.StrokeColor = Colors.Red;
line.StrokeThickness = 10;
//line.Path.Add(several points); Tested, no effect
MapOverlay overlay = new MapOverlay();
overlay.Content = line;
//overlay.GeoCoordinate = new GeoCoordinate(0,0); Tested, no effect
//overlay.PositionOrigin = new Point(0.0, 1.0); Tested, no effect
pathLayer.Add(overlay);
MyMap.Layers.Add(pathLayer);
void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
MapPolyline line = pathLayer.First(TrackPath).Content as MapPolyline;
line.Path.Add(args.Position.Coordinate); // Checked values, line.Path adds them correctly
}
编辑:新信息。仿真器显示错误尝试使用XAML添加它时,和仿真器显示在地图上作为图形毛刺的顶部类的名称:
我也看到了XAML错误,但它仍在建立,当我在XAML中定义路径时,折线显示出来。 – user8709