Windows Phone load BingMaps Chinese map

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.