Use Bing Map

Source: Internet
Author: User

Disclaimer: This article was created by fengyun1989 and is licensed using the knowledge sharing signature-non-commercial use-sharing 2.5 mainland China License Agreement in the same way.

PS: This article is based on the RP version. The usage of bingmap in RTM is similar.

Suddenly I want to use Bing map in Win8. When I want to use Bing map in WP7, I want to add a reference and add a namespace on the page, so that the map will come out. Microsoft is basically a routine, and I guess it is also true in Win8.

You can try it and find out a lot of problems.

1. Add a reference first. Right-click the project reference directory and choose add reference. In the pop-up reference window, nothing is available about Bing. And there are only two references. Find out on the Internet before you know that you have to install Bing Maps for C #, C ++, or visual basic (RP ). Just install a plug-in. I found such a plug-in on the Internet. It is a file suffixed with vsix. It can only be opened and installed using the Extension Manager of vs. After a while, the file is not opened. You can only find it from. It is in tool-expansion and update. Search for the SDK in the Visual Studio library in the online environment. Then install. The following figure shows the installation.

After installation, you can add references. Add these two references.

Now you can use Bing map. Now you can add this namespace to mainpage. XAML.

Then you can use Bing map on the page.

<bing:Map MapType="Birdseye" Credentials="AkzZURoD0H2Sle6Nq_DE7pm7F3xOc8S3CjDTGNWkz1EFlJJkcwDKT1KcNcmYVINU" Width="640" Height="480"/>

But it cannot run now. We can see this sentence in the designer.

I am depressed when I see this. The ARM architecture cannot use Bing Maps. We can only hope that Microsoft can improve the official version. Later, we found that the 64-bit system simply cannot use bingmap. You cannot use a map when you change the platform solution to x64. If Win8 is a 64-bit system, you can change the platform solution to x86. The compilation is successful, but the screen program stops at startup. Don't move. VS has no error message. I think this is the reason for Win8.

It takes so long to change the compilation Configuration Manager. Change Any Cpu to X86.

Now you can compile and run it. This is the case ..

I carefully compared my program and Microsoft's sample program. No difference in code. After careful research, we found that this exception was caused by the Map label. I struggled for a long time and did not find out why. However, during this period, I found a compromise method.

Find the sample download in the expanded and updated sample library.

Then you can create a project. Select as follows:

In this way, a new project is created from the sample template. If MapStyle is selected, this example is the cleanest. There are three buttons and three click events in mainPage. Once deleted, it is as clean as the project you created. Note that the Credentials attribute of the Map is modified. This is a key applied for at Microsoft's Bing Maps (http://www.bingmapsportal.com). It cannot be used without this Map. The key used in my article is extracted from the code found on the Internet. You can use it for practice. For the official version of the software, apply for one by yourself. No money is needed.

If you cannot see the map in the designer, modify the Cpu option of the Configuration Manager. Now you can compile and run the program. You can see the map.

Creating your own project from the example project is indeed quite convenient. However, I don't know why I can't do that process. I feel like I can, but I still don't know why. If you know it, please let me know.

Now the map can be used. I think the default map of Bing map is also Chinese, but it seems that there are no TileSource or other classes in Wp7. It may not work if you want to change the map source. In addition, Microsoft's map service is still a little bad. You need to use Pinyin to search for many things .. However, I would like to use Google or Baidu for this type of map service. After searching, it will be displayed on Bing Map. The only pity is that Arm cannot use a map.

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.