Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Create an app with Bing Maps (for Windows 8.1)

Bing

Follow these steps to develop a Windows Store app for Windows 8.1 using the Bing Maps SDK for Windows Store apps (for Windows 8.1), Windows 8.1 and Visual Studio 2013.

Developing with JavaScript?: See Developing a Windows Store app using JavaScript and the Bing Maps AJAX Control, Version 7.0 documentation.

Migrating your app to Windows 8.1 from Windows 8 or Windows 8.1 Preview? If you created your app with Windows 8 or Windows 8.1 Preview and a version of Visual Studio prior to Visual Studio 2013, see Migrate your app to use the Bing Maps SDK for Windows 8.1.

Otherwise, continue with the following steps.

Create a new Windows Store app with Bing Maps for Windows 8.1

Create a Bing Maps Account and get a Bing Maps Key

You must have a Bing Maps Key to develop Bing Maps for Windows Store apps.

Get Windows 8.1 and Visual Studio 2013

Download and install Windows 8.1 and Microsoft Visual Studio 2013.

Dn456475.Important(en-us,MSDN.10).gifImportant:
Applications developed using Visual Studio 2013 and this SDK are supported on Windows 8.1 and later only.

Install the Bing Maps SDK for Windows Store apps (for Windows 8.1)

Close all instances of Visual Studio, and then download and install the Bing Maps SDK for Windows Store apps (Windows 8.1).

Create your C#, C++, or Visual Basic project

Follow these steps to create a Windows Store app project. Use API reference for Visual Basic, C# and C++ and Code examples provided with this SDK to help you get started. If you already have a Windows Store app and just want to add maps to it, skip this section and go to Set the Active Solution Platform.

Create a Windows 8.1 app

  1. Start Visual Studio 2013.

  2. Select FILE > New > Project.

  3. In the Installed pane, expand Visual C++, Visual C# or Visual Basic depending on the language you want to use.

    Note: The code samples in this documentation use Visual C#.

  4. Select the Windows Store template type, and then select Blank App (XAML).

  5. Type BingMapsWindowsStoreApp as the Name for the project.

  6. Click OK to create the project files.

Set the Active Solution Platform

IMPORTANT: You must set the Active solution platform in Visual Studio to one of the following supported platforms for your app to work correctly.

  1. Select BUILD from the main menu, then 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

Add a reference to the Bing Maps SDK for Windows Store apps

  1. In Visual Studio, select your application in Solution Explorer, and then select PROJECT > Add Reference (or References if you have references already).

    C++ project: If your project is a C++ project, then select PROJECT >yourProjectName Properties.

  2. Expand Windows, and then select Extensions.

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

    Dn456475.Important(en-us,MSDN.10).gifImportant:
    If you do not see this reference or if the version is not 1.313.825.0 or later, and you installed the. SDK for Windows 8.1 (Bing Maps SDK for Windows Store apps (Windows 8.1)), you may need to close the project and Visual Studio, and then open Visual Studio and the project again to see the SDK. If you have not installed the Windows 8.1 SDK, make sure you close Visual Studio before you install the SDK.

Add a map using XAML and code-behind

  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"
    
    Insert the following XAML inside the <Grid> tags, and replace the placeholder INSERT_YOUR_BING_MAPS_KEY with your Bing Maps Key.

    <bm:Map Credentials="INSERT_YOUR_BING_MAPS_KEY" x:Name="myMap"></bm:Map>
    
  3. Your code should look like this:

    <Page
        x:Class="BingMapsWindowsApp.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:BingMapsWindowsApp"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:bm="using:Bing.Maps"
        mc:Ignorable="d">
        <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
            <bm:Map Credentials="INSERT_YOUR_BING_MAPS_KEY" x:Name="myMap"></bm:Map>
        </Grid>
    </Page>
    
  4. Run the code, and a world map appears.

Now that you have learned how to display a map, you can begin to customize the map for your application. For help you can check out the following resources:

Customize your map

You can customize the map properties on the map using XAML or using code-behind. There are code samples throughout out the SDK. You may want to get started quickly with some complete Bing Maps Samples.

Migrate your app to use the Bing Maps SDK for Windows 8.1

Dn456475.note(en-us,MSDN.10).gifNote:
Note that apps built for Windows 8 with Visual Studio 2012 and the Bing Maps SDK for Windows Store apps (for Windows 8) will run on Windows 8.1. However, creating a version of the app for Windows 8.1 using Visual Studio 2013 is recommended. For compatibility information between the Bing Maps for Windows Store apps SDKs and versions of Windows, see the Windows Compatibility table in Getting started with Bing Maps for Windows Store apps.

Follow these steps to migrate your app to Windows 8.1 and update the project to reference the Bing Maps SDK for Windows Store apps (for Windows 8.1). You must have Visual Studio 2013 to use this version of the SDK.

  1. Retarget your app using the process described in Retarget your Windows Store app to Windows 8.1.

  2. Close all instances of Visual Studio and install the Bing Maps SDK for Windows Store apps (for Windows 8.1).

  3. Open your retargeted app project in Visual Studio 2013, select your application in Solution Explorer, and then select References from the PROJECT menu.

    C++ project: If your project is a C++ project, then select PROJECT >yourProjectName Properties.

  4. Expand Windows, and then select Extensions.

  5. Remove Bing Maps for C#, C++, or Visual Basic if the version is prior to 1.313.0825.0.

  6. Add a reference to Bing Maps for C#, C++, or Visual Basic version 1.313.825.0 or later.

  7. Click OK to add the reference.

  8. Rebuild the project and run it.

Show:
© 2015 Microsoft