private async void resetDisplay_Click(object sender, RoutedEventArgs e) { try { // If the LocationDisplay is enabled and a Location currently exists, reset the map // to zero rotation and center on the Location. Otherwise, set the MapView to center on 0,0. if (MyMapView.LocationDisplay != null && MyMapView.LocationDisplay.IsEnabled && MyMapView.LocationDisplay.CurrentLocation != null && MyMapView.LocationDisplay.CurrentLocation.Location.Extent != null) { // Get the current AutoPanMode setting as it is automatically disabled when calling MyMapView.SetView(). var PanMode = MyMapView.LocationDisplay.AutoPanMode; MyMapView.SetRotation(0); await MyMapView.SetViewAsync(MyMapView.LocationDisplay.CurrentLocation.Location); // Reset the AutoPanMode MyMapView.LocationDisplay.AutoPanMode = PanMode; } else { var viewpoint = new Viewpoint(MyMapView.Map.Layers[0].FullExtent) { Rotation = 0.0 }; await MyMapView.SetViewAsync(viewpoint); } } catch (Exception ex) { var _x = new MessageDialog("Sample Error: " + ex.Message).ShowAsync(); } }
private void rotationSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { if (MyMapView.InteractionOptions.RotationOptions.IsEnabled) { MyMapView.SetRotation(e.NewValue); } }
/// <summary>Reset the MapView by removing any map rotation and centering on the existing Location. </summary> private void resetDisplay_Click(object sender, RoutedEventArgs e) { // If the LocationDisplay is enabled and a Location currently exists, reset the map // to zero rotation and center on the Location. Otherwise, set the MapView to center on 0,0. if (MyMapView.LocationDisplay != null && MyMapView.LocationDisplay.IsEnabled && MyMapView.LocationDisplay.CurrentLocation.Location.Extent != null) { // Get the current AutoPanMode setting as it is automatically disabled when calling MyMapView.SetView(). var PanMode = MyMapView.LocationDisplay.AutoPanMode; MyMapView.SetRotation(0); MyMapView.SetView(MyMapView.LocationDisplay.CurrentLocation.Location); // Reset the AutoPanMode MyMapView.LocationDisplay.AutoPanMode = PanMode; } else { var centerPoint = new MapPoint(0, 0); MyMapView.SetView(centerPoint); } }
private void rotationSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { MyMapView.SetRotation(e.NewValue); }
private void rotationSlider_ValueChanged(object sender, Windows.UI.Xaml.Controls.Primitives.RangeBaseValueChangedEventArgs e) { MyMapView.SetRotation(e.NewValue); }