Create an app with Bing Maps (for Windows 8.1 Preview)

Important

If you have an existing app that was built with Visual Studio 2013 Preview, Windows 8.1 Preview and the Bing Maps SDK for Windows Store apps (Beta for Windows 8.1 Preview), it is recommended that you upgrade your app to use Visual Studio 2013, Windows 8.1 and the Bing Maps SDK for Windows Store apps (Windows 8.1).

Follow these steps to develop an application with the Bing Maps SDK for Windows Store apps (Beta for Windows 8.1 Preview).

Important

Bing Maps SDK for Windows Store apps (Beta for Windows 8.1 Preview) is only supported on Windows 8.1 Preview with Microsoft Visual Studio 2013.

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 Preview and Microsoft Visual Studio 2013 Express Preview for Windows from the Windows 8.1 site.

Note

Applications developed using Visual Studio 2013 Express Preview are only supported on the Windows 8.1 Preview operating system.

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

Download and install the Bing Maps SDK for Windows Store apps (Beta for Windows 8.1 Preview).

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

Otherwise, continue with the following steps.

Develop your Bing Maps for Windows Store app using C#, C++, or Visual Basic

The steps to develop a Bing Maps app for Windows 8.1 Preview are the same as for a Windows 8 app. In addition, the API for the Bing Maps SDK for Windows Store apps (Beta for Windows 8.1 Preview) is also the same so you can use the API reference for Visual Basic, C# and C++ and Code examples provided with this SDK to develop your Bing Maps apps for Windows 8.1 Preview.

Create a Windows 8.1 Preview app

  1. Start Visual Studio 2013 Express Preview.

  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 BingMapsWindowsApp as the Name for the project.

  6. Click OK. The project files are created.

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

Reference Bing Maps SDK for Windows Store apps (Beta for Windows 8.1 Preview) and Microsoft Visual C++ Runtime Package

Add a reference to the Bing Maps SDK for C#, C++, or Visual Basic and the Visual C++ Runtime Package.

Important

IMPORTANT: If you are using C# or Visual Basic, you must still add a reference to the Microsoft Visual C++ Runtime Package.

  1. Select PROJECT, then Add Reference from the main menu of Visual Studio 2013.

  2. In the Add Reference dialog, expand Windows, then select Extensions.

  3. Check Bing Maps SDK for C#, C++, or Visual Basic and the Microsoft Visual C++ Runtime Package and click OK.

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="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:BingMapsWindowsApp"
        xmlns:d="https://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="https://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.

Customize your map

You can customize the map properties on the map using XAML or using code-behind, just as you can with Bing Maps for Windows Store apps (for Windows 8). A list of code examples in the API Reference is provided in Code examples. You can also download complete samples at Bing Maps Samples.