2016-06-11 16 views
-1

所以,我有一個冰島地圖的問題,我想把自定義引腳(圖像)到地圖,但我沒有看到所有的引腳只有幾個,當我是縮放銷消失必應地圖,消失自定義引腳

這是我的代碼:

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); 

     } 

請幫幫我!

回答

0

當使用MapIcon的只將它們添加到MapElements屬性,而不是兒童屬性。 MapIcon的設計有一些碰撞檢測功能,當一堆重疊時會隱藏起來。當你放大時,它們應該重新出現。如果你不想要這個,那麼創建一個UserControl作爲圖釘使用,並將其添加到地圖Children的屬性中。查看本文檔中的「在地圖控件上顯示XAML元素」部分:https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn792121.aspx