Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Windows Phone 7.5: Building Location-aware Applications

You're reading from   Windows Phone 7.5: Building Location-aware Applications Build your first Windows Phone application with Location and Maps with this book and ebook.

Arrow left icon
Product type Paperback
Published in Jul 2012
Publisher Packt
ISBN-13 9781849687249
Length 148 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (11) Chapters Close

Windows Phone 7.5: Building Location-aware Applications
Credits
About the Author
About the Reviewers
1. www.PacktPub.com
2. Preface
1. The Location-based World FREE CHAPTER 2. Using Location in Windows Phone 7.5 3. Using Maps in your Windows Phone App 4. Events App - PacktEvents 5. Location-aware News App — PacktNews

Using directions with Bing Maps directions task


We got acquainted with Launchers in our previous topic. Let us now look at BingMapsDirectionsTask, and use it to provide driving directions from within our application:

  1. 1. Create a copy of our HelloMaps-Pushpin project and rename it HelloMaps-Directions.

  2. 2. Open your MainPage.xaml.cs file and import the Microsoft.Phone.Tasks namespace into your project.

    using Microsoft.Phone.Tasks;
    
  3. 3. Assuming the maps center as Redmond, we want to show driving directions to the nearby Mercer Island as depicted in the following screenshot:

  4. 4. We begin by defining a variable myDrivingDirection of type BingMapsDirectionsTask as:

    BingMapsDirectionsTask myDrivingDirection;
    
  5. 5. In our MainPage() constructor, we define the start and end points of our route. The start being some location near Redmond and end being Mercer Island.

    // Show driving directions to Mercer Island
    // Use "null" as the starting location to use your current
    // location as the starting point.
    myDrivingDirection...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image