This example demonstrates how to calculate routes to the destination point from major roads using the BingRouteDataProvider.CalculateRoutesFromMajorRoads method.
Before route calculation, specify destination point coordinates (GeoPoint.Latitude and GeoPoint.Longitude). In addition, you can specify optional parameters: the destination name, driving or walking route travel mode using the BingRouteOptions.Mode property and route optimization options to calculate an optimal route either by time or by distance via the BingRouteOptions.RouteOptimization property.
To start the application, click the Calculate Routes From Major Roads button. All parameters are passed to the CalculateMajorRouteRequest method, and you can see the results in the rich text box element and calculated routes on a map.
The requested results contain the total distance of a route, itinerary item (BingRouteResult.Distance, BingRouteLeg.Distance, BingItineraryItem.Distance), the time required to follow the calculated route (BingRouteResult.Time) and pass the rout leg and itinerary item (BingRouteLeg.Time, BingItineraryItem.Time). You can also see the maneuvers associated with the itinerary item (BingItineraryItem.Maneuver) and other parameters.
Note that if you run this sample as is, you will get a warning message informing that the specified Bing Maps key is invalid. To learn how to register a Bing Maps account and create a key for it, refer to the How to: Get a Bing Maps Key tutorial.
See also: Bing Maps - Information Data Providers (Search, Geocode, Routing) upgrade from SOAP to REST API.