【发布时间】:2015-05-23 18:40:50
【问题描述】:
我想为 Windows phone 8.0 应用程序在地图上的某个位置添加图钉。 到目前为止,我的代码如下:
private async void Button_Click(object sender, RoutedEventArgs e)
{
BasicGeoposition bGeo = new BasicGeoposition();
bGeo.Latitude = 37.4333;
bGeo.Longitude = 24.9167;
Geopoint geoPoint = new Geopoint(bGeo,0);
myMap.ZoomLevel = 13;
myMap.Center = geoPoint;
}
private void AddMapIcon()
{
MapIcon MapIcon1 = new MapIcon();
MapIcon1.Location = new Geopoint(new BasicGeoposition()
{
Latitude = 37.4333,
Longitude = 24.9167
});
MapIcon1.NormalizedAnchorPoint = new Point(2.0, 2.0);
myMap.MapElements.Add(MapIcon1);
}
地图正在正确加载,但图钉不会出现。对此有什么想法吗?有没有什么办法可以在不使用 xaml 控件的情况下做到这一点?
【问题讨论】:
-
您将地图中心设为
geoPoint,但您希望将图钉设置为bGeo。您是否滚动/移动地图并检查图钉是否出现在地图的某个位置?或尝试将 pin 设置为geoPoint进行测试。
标签: c# windows-phone-8 pushpin