Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
The Maps task launches the 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 for Windows Phone 8.
![]() |
---|
The 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 Maps is unavailable in their ___location. |
To use the Maps task
Add a reference to the System.Device assembly to your project.
Add the following statements to your code.
Imports Microsoft.Phone.Tasks
using Microsoft.Phone.Tasks;
Imports System.Device.Location
using System.Device.Location;
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.
Dim mapsTask As MapsTask = New MapsTask() 'Omit the Center property to use the user's current ___location. 'mapsTask.Center = new GeoCoordinate(47.6204, -122.3493); mapsTask.SearchTerm = "coffee" mapsTask.ZoomLevel = 2 mapsTask.Show()
MapsTask mapsTask = new MapsTask(); //Omit the Center property to use the user's current ___location. //mapsTask.Center = new GeoCoordinate(47.6204, -122.3493); mapsTask.SearchTerm = "coffee"; mapsTask.ZoomLevel = 2; mapsTask.Show();