我正在为 Windows phone 7 使用 bing 地图控件,而我的折线仅在模拟器中绘制。当我在设备上运行时没有任何反应......
XDocument doc = XDocument.Parse(getRoute1()); //private string getRoute1() return gpx file
var ns = doc.Root.GetDefaultNamespace();
var loc = doc.Descendants()
.Where(el => el.Name == ns + "wpt" || el.Name == ns + "trkpt")
.Select(trkpt =>
new Location
{
Latitude = double.Parse(trkpt.Attribute("lat").Value),
Longitude = double.Parse(trkpt.Attribute("lon").Value)
}).ToLocationCollection();
mapPolyline.Locations = loc;
maps.Children.Add(mapPolyline);