Cloud Training (Online)




How to get Driving Directions in Windows Phone ?

In Windows Phone , you could use the BingMapsDirectionsTask to get the driving direction from one location to another location.

The BingMapsDirectionsTask will launch the Map application where you could view the directions based on the specified location.

How to get Driving Directions in Windows Phone ?

Below is a sample program to demonstrate How to get Driving Directions in Windows Phone using BingMapsDirectionsTask .

private void button1_Click(object sender, RoutedEventArgs e)
{
            BingMapsDirectionsTask bingMapDirection = new BingMapsDirectionsTask();
            bingMapDirection.Start = new LabeledMapLocation("Bangalore", null);
            bingMapDirection.End = new LabeledMapLocation("Mysore", null);
            bingMapDirection.Show();
}
How to get Driving Directions in Windows Phone ? - 2
How to get Driving Directions in Windows Phone ? – 2

It is necessary to specify the start or the end property of the BingMapsDirectionsTask . If both the Start and End property is empty , then you will receive the InvalidOperationException was unhandled. Start and End cannot both be invalid.

How to get Driving Directions in Windows Phone ?
How to get Driving Directions in Windows Phone ?
Senthil Kumar B
Senthil Kumar is a former Microsoft MVP (Most Valuable Professional). He is a Co-Author of the book "Windows 10 Development Recipes using JavaScript and CSS" for Apress Publication. He is a technical presenter, blogger, mentor and a Geek.  Senthil is a regular speaker is various local user groups. He has presented at conferences like Great Indian Developer Summit (GIDS) & Microsoft DevCamps. You can reach out to him via his Twitter handle @isenthil.