1

我在使用 windows phone mango 的 bing 地图中的路由有问题。当用户每次点击搜索时,我需要更新地图以消除旧路径。我使用了以下指南: http: //msdn.microsoft.com/en-us/library/ee681887.aspx并且它可以工作,但是当我在地图上再次搜索时仍然是旧路径。谢谢您的帮助!

4

1 回答 1

2

我解决了这个问题。我在 xaml 地图中插入了一个属性 MapPolyline“percorso”,这是代码 c#

 // If the route calculate was a success and contains a route, then draw the route on the map.
        if ((e.Result.ResponseSummary.StatusCode == BingMapRouteService.ResponseStatusCode.Success) & (e.Result.Result.Legs.Count != 0))
        {
            this.percorso.Locations = new LocationCollection();
            // Retrieve the route points that define the shape of the route.
            foreach (Location p in e.Result.Result.RoutePath.Points)
            {                   
                Location location = new Location();
                location.Latitude = p.Latitude;
                location.Longitude = p.Longitude;
                this.percorso.Locations.Add(location);
            }                
于 2012-11-22T09:02:29.967 回答