What's the easiest way to put zoom in and zoom out buttons on my map

559
1
Jump to solution
07-01-2021 01:12 PM
rodsan724
New Contributor II

Given:  

Visual Studio 2019 Pro  

ArcGIS Tutorial - Display a map

 

What's the easiest way to put zoom in and zoom out buttons on the map? I know you can use a scroll wheel but I need the zoom buttons to show as well.

 

0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Frequent Contributor

I'm assuming you're using XAML, so add two <Button /> controls to your view, and in their click handlers, call one of the SetViewpoint* operations. For example:

mapView.SetViewpointScaleAsync(mapView.MapScale / 2); // Zoom in
mapView.SetViewpointScaleAsync(mapView.MapScale * 2); // Zoom out

View solution in original post

1 Reply
dotMorten_esri
Esri Frequent Contributor

I'm assuming you're using XAML, so add two <Button /> controls to your view, and in their click handlers, call one of the SetViewpoint* operations. For example:

mapView.SetViewpointScaleAsync(mapView.MapScale / 2); // Zoom in
mapView.SetViewpointScaleAsync(mapView.MapScale * 2); // Zoom out