Starting Bing Map for Windows Store App (XAML)


In the previous post “Bing Map for Windows Store Apps” we had seen about Bing map’s key creation and management. In this post we would see how we could use it in a Windows Store App written in C #and XAML.

Creating a Windows Store C#/XAML App

As you are familiar with the templates for creating a Windows Store App, I am creating a Blank app for this example.

Download Bing Maps SDK for Windows Store Apps

You need to get the Bing Maps SDK for Windows Store Apps to have the map control. You can download the SDK by clicking here.

Adding Reference to Bing Maps

Assuming you have downloaded and installed the Bing Maps SDK for Windows Store Apps, the next step is to add reference to your project.

As displayed in the above image, you could find the Bing Maps SDK under Windows àExtensions. Click OK to add the reference to your project.

Build Issues after adding reference

You might find build errors, which is similar to the following.

If you noticed, as soon as you had added the reference to Bing Maps SDK, a warning notification appears. As displayed in the below image.

This is because the Bing Maps Control has no configuration for applications with configuration “Any CPU”. You might need to change it to your target CPU architecture.

You can always change it in project properties. The following image would help you regarding this.

Note that, as soon as you change and save the settings your warning in reference would go away.

Adding Map Control to the XAML

The easiest way to add a map control to XAML is to open the XAML page in Blend. You could search for the control which looks like following.

Add it to the page based on your design. The following is the design preview when you add it to the page. (Of course I designed it to be stretched it both horizontally and vertically; you might not need to follow my design.)

Adding Bing Map Key to Map Control

A Bing Map Key is the heart of the Map control. To obtain a key you could follow my previous article “Bing Map for Windows Store Apps“.

Well if you have already a key. You could map it as follows.

And the Resource is in App.xaml

Bing Map at Runtime

Well with default settings of a Bing Map control the map would look like the following.

Hope this article helps, thanks for reading.