[Windows Phone] replacing Bing map with Google map in Windows Phone applications

Source: Internet
Author: User

Recently, I made an application that uses maps and related functions. By default, I did not find a third-party map API. I directly used the Bing map control, however, it took some time to find that Bing map was still unavailable for Chinese users. Many of them were not identified by geographical locations and were not detailed enough. So Google map was immediately considered, so I found related resources, using Google map in Windows Phone applications is actually very simple. The following describes the steps:

1. There is an encapsulated DLL Class Library: googlemaps. dll (click to download). This is the core content. add reference to this DLL in the project first:

2. Add several references to the XAML file and name them:

 

Xmlns: My = "CLR-namespace: Microsoft. Phone. Controls. Maps; Assembly = Microsoft. Phone. Controls. Maps"
Xmlns: googletilesource = "CLR-namespace: googlemaps; Assembly = googlemaps"
Xmlns: mspcmcore = "CLR-namespace: Microsoft. Phone. Controls. Maps. Core; Assembly = Microsoft. Phone. Controls. Maps"

 

3. calling Google map is a simple example. WP development is much more convenient than iOS development. Thanks to this DLL, you only need to nest a bit of content in the original Bing map control. Adding tags and obtaining geographic locations do not affect the content of the XAML as follows:

 

<My: Map x: Name = "mMain" margin = "," copyrightvisibility = "Collapsed" logovisibility = "Collapsed" scalevisibility = "visible" credentialsprovider = "ApBXPZf5IR94SLXE8nh5FYsb5WHKrH1XPY7428-EqQudseivcWhCROIJvGmtnkAV">
<My: maptilelayer name = "street" margin = "0, 0, 0, 32">
<My: maptilelayer. tilesources>
<Googletilesource: googletile tiletypes = "street">
</Googletilesource: googletile>
</My: maptilelayer. tilesources>
</My: maptilelayer>
</My: Map>

 

I have not studied the specific internal implementation. If you are interested, you can find the source code of this DLL.

The effect is as follows:

I hope this example will be useful to you!

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.