更新地图windows phone芒果

时间:2012-11-20 22:22:57

标签: windows-phone-7.1 bing-maps

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

1 个答案:

答案 0 :(得分:2)

我解决了这个问题。我在xaml map中插入了一个属性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);
            }