2013-04-14 99 views
1

我是Windows Phone 8開發的新手,我在添加MapLayer按鈕時遇到了問題。 我想顯示在地圖的按鈕,所以我只畫它的地圖工具是這樣的:如何在windows phone 8中的地圖/ MapLayer上顯示按鈕?

<Grid x:Name="MyMapGrid" Margin="10,-15,15,0" VerticalAlignment="Top" Height="296" > 
      <maps:Map x:Name="MyMapi" Center="31.765537,35.106812" ZoomLevel="7" Margin="0,0,0,0" VerticalAlignment="Top" Height="296" Width="442" /> 
       <Button x:Name="myCustomButton" Visibility="Visible" Content="" HorizontalAlignment="Left" Margin="347,0,0,0" VerticalAlignment="Top" Width="84" Height="84" BorderThickness="0"> 
        <Button.Background> 
         <ImageBrush ImageSource="/myZoom.png"/> 
        </Button.Background> 
       </Button> 
      </Grid> 



After this action I need to put some icons on the map so I used MapOverlay and MapLayer like this: 


Map MyMap = new Map(); 
MapOverlay overlay = new MapOverlay 
      { 
       GeoCoordinate = MyMap.Center, 
       Content = new Image() 
       { 
        Source = new BitmapImage(new Uri("customIcon.png", UriKind.Relative)), 
       } 
      }; 
MapLayer layer = new MapLayer(); 
layer.Add(overlay); 
MyMap.Layers.Add(layer); 
MyMapGrid.Children.Add(MyMap); 



I also need my button (myCustomButton) will stay visible - but it disappear. 

how can I still have some button over the map and also view some icons on it? 
Thank you all! 

回答

0

對於按鈕更改路徑,以確定類似的ImageSource =「/資產/圖標/ location.png 「與文件夾名稱並確保BuildAction設置爲該圖像的內容 對於圖標也嘗試相同。

相關問題