【发布时间】:2012-08-18 19:46:25
【问题描述】:
public void setMap()
{
GeoCoordinate mapCener = new GeoCoordinate(39.920794, 32.853902);
Pushpin pin1 = new Pushpin();
pin1.Location = mapCener;
pin1.Content = hereContent;
map1.Children.Add(pin1);
foreach (var item in pinList)
{
MessageBox.Show(item.Location.Latitude.ToString()+","+item.Location.Longitude.ToString());
mapCener = new GeoCoordinate(item.Location.Latitude, item.Location.Longitude);
pin1 = new Pushpin();
pin1.Content = "K";
map1.Children.Add(pin1);
map1.SetView(mapCener, 0);
}
int zoom = 10;
map1.SetView(mapCener, zoom);
map1.ZoomBarVisibility = Visibility.Visible;
}
我有一个 PushPins 列表,其中包含不同位置的坐标。我也有中心点,它显示了手机的位置。
我尝试将图钉添加到地图中,内容“K”显示在屏幕的左上角。我的 PushPin 列表包含正确的坐标,但它们在地图上的位置是错误的。可能是什么原因?
【问题讨论】:
-
您好,我没有看到 foreach 循环中引脚的位置,这可能会导致问题。
-
pinList 包含引脚的位置。 foreach 循环中的 MessageBox 显示了应有的位置。
-
我的意思是我没有在 foreach 循环中看到 pin1.location。