Export (0) Print
Expand All

Add Bing Maps to an app

Bing

This topic outlines how to add the Bing Maps SDK for Windows Store apps to a Visual Studio 2013 C#, C++ or Visual Basic project.

If you want to use JavaScript, see Developing a Windows Store app using JavaScript in the Bing Maps AJAX Control 7.0 documentation.

Install the Bing Maps SDK for Windows Store apps

Install the Bing Maps SDK for Windows Store apps (for Windows 8.1). Do this before opening Visual Studio 2013. If you install the SDK while Visual Studio is open, you will have to close Visual Studio and open it again to see the SDK.

Set the active solution platform

You must set the active solution platform to a value supported by the Bing Maps SDK.

  1. Select BUILD > Configuration Manager.

  2. Choose one of the following supported solution platforms for the current project.

    • C#, Visual Basic: ARM, x86 or x64

    • C++: ARM, Win32 or x64

  3. Click Close.

Reference the Bing Maps SDK

Before you can add a map to your Windows Store app, you must first add a reference to the Bing Maps SDK. The steps are slightly different depending on your programming language choice.

For a C# or Visual Basic project:

  1. In Visual Studio, select PROJECT > Add Reference (or References if you have references already).

  2. Expand Windows, and then select Extensions.

  3. Select Bing Maps for C#, C++, or Visual Basic, and then click OK.

For a C++ project:

  1. In Visual Studio, select PROJECT >yourProjectName Properties.

  2. Click Add New Reference (or References if you have references already).

  3. Expand Windows, and then select Extensions.

  4. Select Bing Maps for C#, C++, or Visual Basic, and then click OK.

    Click OK again.

Insert a map into your app

Finally, insert a map into your app.

  1. Open MainPage.xaml in your project. This file contains the XAML that defines the user interface.

  2. Add the following namespace declaration in the Page tag.

    xmlns:bm="using:Bing.Maps"
    
  3. Insert the following XAML inside the <Grid> tags, and replace the placeholder INSERT_YOUR_BING_MAPS_KEY with your Bing Maps Key. Information about getting a Bing Maps Key is found in Create a Bing Maps Key.

    <bm:Map Credentials="INSERT_YOUR_BING_MAPS_KEY" x:Name="myMap"></bm:Map>
    
Show:
© 2014 Microsoft