如何在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 1790查看 1回答
麥子要抽穗
2021-09-23 17:42:41 495查看 2回答
lockthelight
2021-09-23 17:42:45 493查看 3回答