Book Image

Windows Phone 7.5: Building Location-aware Applications

Book Image

Windows Phone 7.5: Building Location-aware Applications

Overview of this book

Windows Phone 7.5 has met with some great initial reviews from all mobile critics. It is poised to be the '3rd' eco-system for mobile, joining Apple's iOS and Google's Android platform. With Microsoft and Nokia working on multiple devices based on Windows Phone, the platform is a no-brainer enterprise success. Microsoft Office, Email, Skype and a fresh new mobile operating system has been a great champion of a cause for both Microsoft and Nokia. "Windows Phone 7.5: Building Location-aware Applications" will teach you to divein to the new Windows Phone Experience. No more 600 page bibles - just the right mix of text and lots of code to get you started!"Windows Phone 7.5: Building Location-aware Applications" covers location based services and maps, and focuses on methods of location detection and maps. Powered with this information, two real-world applications are covered. In short, this is a concise book on building location aware apps for Windows Phone.
Table of Contents (11 chapters)
Windows Phone 7.5: Building Location-aware Applications
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

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. 1. We start by creating a new project titled HelloMaps-Pushpin.

  2. 2. From our HelloMaps example, reintegrate the same UI, maps, and text labels, and from our Hello Location example, import the TextBlock named statusText. Your UI should now look like the following screenshot:

  3. 3. Open MainPage.xaml.cs and copy over the location variable and methods from the Hello Location example. Add a variable in the global scope called zoomLevel that controls your map's zoom level.

    GeoCoordinateWatcher locationManager;
    double zoomLevel...