Start to Develop Bing Map Application (2)

Published on Wednesday, July 20, 2011

We have finished the first step: Apply a Bing map key to develop Bing map application.

Now we are going to write code for a simple Bing map application. What we first need to do is install Bing map SDK, we have already had an article about Bing map SDK. but the SDK information updated by Microsoft, so please find the newest Bing map SDK from Microsoft official site and download proper SDK package for your application.

For example, if you want to create a Bing map application using Silverlight, you should download Bing map Silverlight controls. The download place is here. After your download, you will find a file named "BingMapsSilverlightControlv1.0.1Installer.msi". double click to install the Bing map SDK.

Now we use Visual Studio 2010, create a new Silverlight Application:


In the project, right click the Silverlight Application’ references folder to Add Reference.


Locate the installing Bing map SDK folder, just like the following:


There are two dll files under the Libraries folder:


Add these two files as references.

Note: You do not need to download the control if you are only going to use the embedded maps feature or if you want to access the Bing Maps Silverlight Control using JavaScript. These features are described in the Embedding a Map into Your Web Page and the Accessing the Control Using Script topics. – From MSDN

__Open MainPage.xaml, you can see the following code:

<UserControl x:Class="SilverlightApplication1.MainPage"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White"></Grid>

Changed above code to below code:

<UserControl x:Class="SilverlightTestApplication.MainPage"
    <Grid x:Name="LayoutRoot" Background="White">
        <m:Map CredentialsProvider="your key" Mode="Aerial" />

At once, you will see your Sign windows of Visual studio display a Bing map like the following:


Then, run the application in Visual Studio, you will see the Bing map in web browser.