I believe many people have used the BM Control During WP7 development.
But as a Chinese, looking at the map in English only, I still feel awkward.
So I searched the method on the Internet and implemented it myself. Now I will share it with you!
First, add the following code in the XAML code:
xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps"
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <my:Map x:Name="myMap" HorizontalAlignment="Left" VerticalAlignment="Top" Height="607" Width="456" Margin="0" CredentialsProvider="[LIVEID]" LogoVisibility="Collapsed" CopyrightVisibility="Collapsed" ZoomBarVisibility="Visible"/>
</Grid>
Add the following code to the xaml. cs file:
void MainPage_Loaded(object sender, RoutedEventArgs e) { UriBuilder tileSourceUri = new UriBuilder("http://r2.tiles.ditu.live.com/tiles/r{quadkey}.png?g=41"); MapTileLayer tileLayer = new MapTileLayer(); Microsoft.Phone.Controls.Maps.Platform.Location first = new Microsoft.Phone.Controls.Maps.Platform.Location(); first.Latitude = 60; first.Longitude = 60; LocationRectTileSource tileSource = new LocationRectTileSource(tileSourceUri.Uri.ToString(), new LocationRect(first, 180, 180), new Range<double>(1, 16)); tileLayer.TileSources.Add(tileSource); tileLayer.Opacity = 0.9; myMap.Children.Add(tileLayer); myMap.Mode = new MercatorMode(); }
The following results after the test run:
The source code is as follows:
Http://dl.dbank.com/c01t5zidso
In addition, the younger brother has created a WP7 development and exchange QQ group. welcome to all the blog experts and mavericks.
QQ group: 170716593