Using pushpins with maps
We have seen how to change map modes, however just a simple map without any focus does not make much sense, does it? So we move further and modify the HelloMaps
example by using the Windows Phone Location Service to add a pushpin to the map — signifying the user's detected location.
The Pushpin
class is part of the Microsoft.Phone.Controls.Maps
namespace, with location as one of the properties. So let's use this property in our code and render a simple pushpin:
1. We start by creating a new project titled
HelloMaps-Pushpin
.2. From our
HelloMaps
example, reintegrate the same UI, maps, and text labels, and from ourHello Location
example, import theTextBlock
namedstatusText
. Your UI should now look like the following screenshot:3. Open
MainPage.xaml.cs
and copy over the location variable and methods from theHello Location
example. Add a variable in the global scope calledzoomLevel
that controls your map's zoom level.GeoCoordinateWatcher locationManager; double zoomLevel...