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 ?

Leave a Reply