C# 在UWP中将图钉添加到MapControl

C# 在UWP中将图钉添加到MapControl,c#,xaml,windows-runtime,winrt-xaml,uwp,C#,Xaml,Windows Runtime,Winrt Xaml,Uwp,我想在Windows 10应用程序中的地图控件中添加图钉,但该控件似乎从Windows 8.1开始就消失了 就这么简单: Pushpin locationPushpin = new Pushpin(); locationPushpin.Background = new SolidColorBrush(Colors.Purple); locationPushpin.Content = "You are here"; locationPushpin.Ta

我想在Windows 10应用程序中的地图控件中添加图钉,但该控件似乎从Windows 8.1开始就消失了

就这么简单:

Pushpin locationPushpin = new Pushpin();                      
locationPushpin.Background = new SolidColorBrush(Colors.Purple);
locationPushpin.Content = "You are here";
locationPushpin.Tag = "locationPushpin";
locationPushpin.Location = watcher.Position.Location;
this.map.Children.Add(locationPushpin);
this.map.SetView(watcher.Position.Location, 18.0);

但图钉类型不再被识别…

地图控制在UWP中几乎没有变化-请看一看

至于添加图钉(POI),您可以。例如:

//获取位置
地理点myPoint=新的地理点(新的基本地理位置(){纬度=51,经度=0});
//创建POI
MapIcon myPOI=new-MapIcon{Location=myPoint,NormalizedAnchorPoint=new-Point(0.5,1.0),Title=“我的位置”,ZIndex=0};
//添加到地图并将其居中
myMap.mapements.Add(myPOI);
myMap.Center=myPoint;
myMap.ZoomLevel=10;

查看更多指南。

当用户在某个纬度和经度放置地图图标时,是否可以拖动此地图图标并获取位置?@KinjanBhavsar我还没有玩那么多,但是我会在MapControl类及其事件中进行搜索。我会搜索相同的。检查MapControl的事件得到一个
CenterChanged-当MapControl的Center属性值更改时发生。
会有帮助吗?@KinjanBhavsar我想可能会-试试看。