本文介绍了如何将图钉项添加到地图吗? Windows手机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想画一个图钉在我的应用程序的地图页面的映射,但是当我添加代码来覆盖一个图钉的地图,我收到以下错误:
and
I understand from this that I'm missing a reference? I have references for controls.maps
and contols.toolkit
, so I can't understand why.
Also this is the code I'm using to draw the pushpin:
PushPin myPin = new Pushpin();
myPin.Location = MyGeoPosition;
myPin.Content = "My car";
MyMap.Children.Add(myPin);
解决方案
Try this.
MapLayer layer1 = new MapLayer();
Pushpin pushpin1 = new Pushpin();
pushpin1.GeoCoordinate = MyGeoPosition;
pushpin1.Content = "My car";
MapOverlay overlay1 = new MapOverlay();
overlay1.Content = pushpin1;
overlay1.GeoCoordinate = MyGeoPosition;
layer1.Add(overlay1);
myMap.Layers.Add(layer1);
You create new overlay for each pushpin, add all overlays to a layer, and add the layer to the map element.
这篇关于如何将图钉项添加到地图吗? Windows手机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!