我有同样的问题,例如This question,但它仅针对某些方向而不是所有方向。
MapPB.IsIndeterminate = true;
MapPB.Visibility = Visibility.Visible;
Geopoint destGeopoint = new Geopoint(new BasicGeoposition() { Latitude = Convert.ToDouble(location.Latitude), Longitude = Convert.ToDouble(location.Longitude) });
MapRouteFinderResult routeResult = await MapRouteFinder.GetDrivingRouteAsync(MyGeopoint, destGeopoint, MapRouteOptimization.Distance, MapRouteRestrictions.None);
if (routeResult.Status == MapRouteFinderStatus.Success)
{
// Use the route to initialize a MapRouteView.
MapRouteView viewOfRoute = new MapRouteView(routeResult.Route);
viewOfRoute.RouteColor = App.ApplicationThemeColor;
viewOfRoute.OutlineColor = App.ApplicationThemeColor;
// Add the new MapRouteView to the Routes collection
// of the MapControl.
MapControl1.Routes.Clear();
MapControl1.Routes.Add(viewOfRoute);
// Fit the MapControl to the route.
await MapControl1.TrySetViewBoundsAsync(
routeResult.Route.BoundingBox,
null,
Windows.UI.Xaml.Controls.Maps.MapAnimationKind.None);
}
MapPB.IsIndeterminate = false;
MapPB.Visibility = Visibility.Collapsed;
在上面的代码中,routeResult.Status返回InvalidCredentials,但仅限于某些点,而不是所有点。