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. Create a copy of our
HelloMaps-Pushpin
project and rename itHelloMaps-Directions
.2. Open your
MainPage.xaml.cs
file and import theMicrosoft.Phone.Tasks
namespace into your project.using Microsoft.Phone.Tasks;
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. We begin by defining a variable
myDrivingDirection
of typeBingMapsDirectionsTask
as:BingMapsDirectionsTask myDrivingDirection;
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...