MapPolyLine进入MapLayer-Bing WPF

时间:2018-09-25 14:43:21

标签: c# wpf bing-maps

我的代码

    public void BuildMapLine(List<Location> locations)
    {

        MapLayer mapLayer = new MapLayer();

        mapLayer.Children.Clear();
        MapPolyline polyline = new MapPolyline();
        polyline.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Blue);
        polyline.StrokeThickness = 5;
        polyline.Opacity = 0.7;
        polyline.ToolTip = Hurricane;
        polyline.Locations = new LocationCollection();
        foreach(var item in locations)
        {
            polyline.Locations.Add(item);
        }
        mapLayer.AddChild(polyline, polyline.Locations); //error , cant take in a list of locations
        mWindow.myMap.Children.Add(mapLayer);
    }

问题是我似乎无法将折线添加到地图图层,我希望它可以在地图图层中与要添加到地图上的图钉分开删除

我该怎么做?

0 个答案:

没有答案