您好,我在地图上显示多个图钉时遇到了一些问题。到目前为止,我已经尝试添加单个图钉或首先将它们放入 MapLayer 中,然后将 maplayer 添加到地图中,但我仍然只得到我创建的最后一个图钉。代码示例在这里:
MapLayer layer = new MapLayer();
Pushpin pin1 = new Pushpin();
GeoCoordinate geo= new GeoCoordinate();
geo.Latitude = 45.8074417114258 ;
geo.Longitude = 15.9677000045776;
pin1.Location = geo;
layer.Children.Add(pin1);
Pushpin pin2 = new Pushpin();
GeoCoordinate geo1 = new GeoCoordinate();
geo1.Latitude = 45.9074417114258;
geo1.Longitude = 15.8677000045776;
pin1.Location = geo1;
layer.Children.Add(pin2);
map1.Children.Add(layer);