2013-04-14 58 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设置为该图像的内容 对于图标也尝试相同。

相关问题