如何在mapcontrol控件上显示多个地点标注
TsanyLee。
对于你提到的问题,我创建了一个示例工程去测试,以下是我的代码:
MainPage.xaml:
private void Button_Click(object sender, RoutedEventArgs e)
{
AddMapIcon();
}
private void AddMapIcon()
{
MapIcon MapIcon1 = new MapIcon();
MapIcon
1.Location = new Geopoint(new BasicGeoposition()
{
Latitude = 4
7.620,
Longitude = -12
2.349
});
MapIcon
1.NormalizedAnchorPoint = new Point(0.5,
1.0);
MapIcon
1.Title = "Space Needle";
MapIcon
1.Visible = true;
MapIcon
1.ZIndex = int.MaxValue;
MapControl
1.MapElements.Add(MapIcon1);
MapIcon MapIcon2 = new MapIcon();
MapIcon
2.Location = new Geopoint(new BasicGeoposition()
{
Latitude = 4
7.603569,
Longitude = -12
2.329453
});
MapIcon
2.NormalizedAnchorPoint = new Point(0.5,
1.0);
MapIcon
2.Title = "Seattle";
MapIcon
2.Visible = true;
MapIcon
2.ZIndex = int.MaxValue;
MapControl
1.MapElements.Add(MapIcon2);
MapControl
1.Center = MapIcon
1.Location;
MapControl
1.ZoomLevel = 12;
}
如你所提到的,在模拟器上,MapIcon有时候可以显示,但是缩放后,有些又可以正常显示,对于这个问题,我尝试通过强制自定义MapIcon的Image属性,但是没有解决。
通过定位问题,觉得可能的问题是在于模拟器,于是在真机上发现均可以正常显示这些点,所以建议你在真机上测试程序的效果。
--------------------------------------------------------------------------------
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.
2021-09-23 17:41:06 2034查看 1回答
2021-09-23 17:42:41 542查看 2回答
2021-09-23 17:42:45 547查看 3回答