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.
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 inmapView.SetViewpointScaleAsync(mapView.MapScale * 2); // Zoom out
This works for me!
await mapView.SetViewpointScaleAsync(mapView.GetCurrentViewpoint(ViewpointType.CenterAndScale).TargetScale / 2); // Zoom In
await mapView.SetViewpointScaleAsync(mapView.GetCurrentViewpoint(ViewpointType.CenterAndScale).TargetScale * 2); // Zoom Out
@RonakPatel That code is equivalent to what I wrote above, but it's a more round-about way requiring a lot more calls.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.