Overview

The Bing™ Maps Silverlight® Control for Windows® Phone combines the power of Silverlight and Bing Maps to provide an enhanced mapping experience. Developers can use the Bing Maps Silverlight Control to incorporate the latest location and local search features into their Windows Phone applications.

Using both Bing Maps Silverlight Control and the Bing Maps SOAP (strategy on a page) Services, you can create Windows Phone applications that include an enhanced mapping experience.

This lab walks you through the steps required for using the Bing Maps Silverlight Control for Windows Phone, and provides a quick reference for developing Windows Phone applications integrated with Bing Maps.

Objectives

Upon completion of the lab you will:

  • Be familiar with Bing Maps for Windows Phone
  • Understand how to use Bing Map control with Data Binding
  • Have used Bing Maps services to fetch mapping data
  • Have created a simple map-based application, complete with pushpins and route layers

Prerequisites

The following is required to complete this hands-on lab:

  • Microsoft Visual Studio® 2010 Express for Windows Phone or Microsoft Visual Studio 2010
  • Windows Phone Developer Tools
  • Active Internet Connection
    Note:
    You can download all Windows Phone development tools in one package from http://developer.windowsphone.com

Setup

For your convenience, much of the code used in this hands-on lab is available as Visual Studio code snippets.

To install the code snippets:

  1. Run the .vsi installer located in the lab's Source\Setup folder.
    Note:
    If you have issues running the code snippets installer you can install the code snippets manually by copying all the .snippet files located in the Source\Setup\CodeSnippets folder of the lab to the following folder:

    <your-documents-folder>\Visual Studio 2010\Code Snippets\Visual C#\My Code Snippets

Using the Code Snippets

With code snippets, you have all the code you need at your fingertips. The lab document will tell you exactly when you can use them. For example,

Figure 1

Using Visual Studio code snippets to insert code into your project

To add this code snippet in Visual Studio, you simply place the cursor where you would like the code to be inserted, start typing the snippet name (without spaces or hyphens), watch as IntelliSense picks up the snippet name, and then press the Tab key twice when the snippet you want is selected. The code will be inserted at the cursor location.

Figure 2

Start typing the snippet name

Figure 3

Press Tab to select the highlighted snippet

Figure 4

Press Tab again to expand the snippet

To insert a code snippet using the mouse rather than the keyboard, right-click where you want to insert the code snippet, select Insert Snippet followed by My Code Snippets and then pick the relevant snippet from the list.

To learn more about Visual Studio IntelliSense Code Snippets, including how to create your own, see http://msdn.microsoft.com/en-us/library/ms165392.aspx.

Exercises

This hands-on lab comprises the following exercises:

  1. Introduction to the Bing Map Control
  2. Handling and Customizing Pushpins
  3. Calculating and Rendering a Route

Estimated time to complete this lab: 90 minutes.