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.
__Open MainPage.xaml, you can see the following code:
<UserControl x:Class="SilverlightApplication1.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="White"></Grid> </UserControl>
Changed above code to below code:
<UserControl x:Class="SilverlightTestApplication.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl"> <Grid x:Name="LayoutRoot" Background="White"> <m:Map CredentialsProvider="your key" Mode="Aerial" /> </Grid> </UserControl>
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.