我无法在c#(WPF)中删除bing map中的路标,我使用了waypoint remove,clear,removeat但仍未删除.....
来源和目的地是位置(纬度,经度)
startWaypoint = new Bing.Maps.Directions.Waypoint(Source);
endWaypoint = new Bing.Maps.Directions.Waypoint(Destination);
waypoints = new Bing.Maps.Directions.WaypointCollection();
waypoints.Add(startWaypoint);
waypoints.Add(endWaypoint);
//Start = waypoints.IndexOf(startWaypoint);
//End = waypoints.IndexOf(endWaypoint);
directionsManager = GuideMap.DirectionsManager;
directionsManager.Waypoints = waypoints;
// Calculate route directions
Bing.Maps.Directions.RouteResponse response = await directionsManager.CalculateDirectionsAsync();
route = response.Routes[0];
// Display the route on the map
directionsManager.ShowRoutePath(response.Routes[0]);
答案 0 :(得分:0)
我认为这会起作用
directionsManager.Waypoints.Remove(startWaypoint);
我不确定没有测试过。
清除路线
directionsManager.ClearActiveRoute();
答案 1 :(得分:0)
我得到了相同的代码: -
//清除路径或路线& //清除或删除路径或路线的Waypints。
GuideMap.DirectionsManager.HideRoutePath(GuideMap.DirectionsManager.ActiveRoute);
GuideMap.DirectionsManager.ClearActiveRoute();
MapLayer directionsLayer = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(GuideMap, 0), 0), 0) as MapLayer;
directionsLayer.Children.Clear();
答案 2 :(得分:0)
很长时间才能得到答案,但我正在研究清除路线的相同问题
取代:
directionsManager.ShowRoutePath(response.Routes[0]);
使用:
directionsManager.ActiveRoute(response.Routes[0]);
然后是:
directionsManager.ClearActiveRoute();