0 out of 1 rated this helpful - Rate this topic

How to: Use the Bing Maps Task for Windows Phone

Windows Phone

March 23, 2012

The Bing Maps task launches the Bing Maps application. You can provide a search string that is used to find and mark locations on the map. You can optionally specify a center point for the map that appears. If you do not specify the center, the user’s current location is used as the center. You can also specify the zoom level to use initially when the map appears.

By using Launchers, you help provide a consistent user experience throughout the Windows Phone platform. For more information, see Launchers and Choosers Overview for Windows Phone.

Important noteImportant Note:

The Bing Maps application will not be launched if the device is in a location where it is not supported. Instead, a dialog will be displayed to the user indicating that Bing Maps is unavailable in their location.

NoteNote:

multiple devicesIf you are developing your application to target 256-MB devices, consider using a BingMapsTask instead of a Map control. Memory allocated for a BingMapsTask does not count towards the total memory usage of your application. This helps minimize the memory impact of your application, which is of particular importance when running on a 256-MB device. For more information, see Developing for 256-MB Devices.

To use the Bing Maps task

  1. Add a reference to the System.Device assembly to your project.

  2. Add the following statements to your code.

    using Microsoft.Phone.Tasks;
    using System.Device.Location;
    
  3. Add the following code to your application wherever you need it, such as in a button click event. To test this procedure, you can put the code in the page constructor. This is the code to launch the task.

    BingMapsTask bingMapsTask = new BingMapsTask();
    
    //Omit the Center property to use the user's current location.
    //bingMapsTask.Center = new GeoCoordinate(47.6204, -122.3493);
    
    bingMapsTask.SearchTerm = "coffee";
    bingMapsTask.ZoomLevel = 2;
    
    bingMapsTask.Show();
    

Did you find this helpful?
(1500 characters remaining)