必应地图,消失自定义引脚
问题描述:
所以,我有一个冰岛地图的问题,我想把自定义引脚(图像)到地图,但我没有看到所有的引脚只有几个,当我是缩放销消失必应地图,消失自定义引脚
这是我的代码:
foreach (Stores store in boltok)
{
var myPosition = new Windows.Devices.Geolocation.BasicGeoposition();
myPosition.Latitude = store.Latitude;
myPosition.Longitude = store.Longitude;
var myStorePoint = new Windows.Devices.Geolocation.Geopoint(myPosition);
MapIcon icon = new MapIcon();
icon.Location = new Geopoint(new BasicGeoposition()
{
Latitude = store.Latitude,
Longitude = store.Longitude
});
icon.Visible = true;
icon.ZIndex = 0;
icon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/StoreFinder/Pin.png"));
icon.NormalizedAnchorPoint = new Point(0.5, 1.0);
myMapControl.MapElements.Add(icon);
myMapControl.Children.Add(icon);
}
请帮帮我!
答
当使用MapIcon的只将它们添加到MapElements属性,而不是儿童属性。 MapIcon的设计有一些碰撞检测功能,当一堆重叠时会隐藏起来。当你放大时,它们应该重新出现。如果你不想要这个,那么创建一个UserControl作为图钉使用,并将其添加到地图Children的属性中。查看本文档中的“在地图控件上显示XAML元素”部分:https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn792121.aspx