What is the procedure in the .NET runtime to set the default mouse drag to zoom rather than pan. This is done in the Java API with ZoomOverlay but I can't seen to find a way to switch in the .NET runtime. I want to attach the code to a button on the UI so that the user doesn't have to hold down the shift key to create the drag-zoom window.
Solved! Go to Solution.
So the workflow to do that is to allow user to drag a rectangle and then zoom to it. You can achieve this by invoking a button
C# code
private async void ZoomToEnvelopeButton_Click(object sender, RoutedEventArgs e) { // use the MapView's Editor to request geometry (Envelope) from the user and await the result var newExtent = await MyMapView.Editor.RequestShapeAsync(Esri.ArcGISRuntime.Controls.DrawShape.Rectangle); // set the map view extent with the Envelope await MyMapView.SetViewAsync(newExtent); }
XAML code
<Button x:Name="ZoomToEnvelopeButton" Content="Set Extent" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="100" Width="125" Click="ZoomToEnvelopeButton_Click"></Button>
So the workflow to do that is to allow user to drag a rectangle and then zoom to it. You can achieve this by invoking a button
C# code
private async void ZoomToEnvelopeButton_Click(object sender, RoutedEventArgs e) { // use the MapView's Editor to request geometry (Envelope) from the user and await the result var newExtent = await MyMapView.Editor.RequestShapeAsync(Esri.ArcGISRuntime.Controls.DrawShape.Rectangle); // set the map view extent with the Envelope await MyMapView.SetViewAsync(newExtent); }
XAML code
<Button x:Name="ZoomToEnvelopeButton" Content="Set Extent" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="100" Width="125" Click="ZoomToEnvelopeButton_Click"></Button>
The c# code was just what I was looking for. Works great. Many thanks.