Showing a Location with the Built-In Maps App

Often it is not necessary to go to the trouble of building a dedicated map view into your app. The built-in Maps app can be launched directly from your own app using the MapsTask launcher. Observe the following example:

MapsTask mapsTask = new MapsTask    {        Center = new GeoCoordinate(47.6204, -122.3493),        ZoomLevel = 8,        SearchTerm = "Caffe"    };mapsTask.Show();

The MapsTask class allows you to position the map view using its Center and ZoomLevel properties. You can also specify a search term that causes the map to display all matching search results on the map.

The sample’s MapViewModel class demonstrates the MapsTask using a command named ViewInMapsAppCommand ...

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.