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!