Select to view content in your preferred language

How to implement RubberBand ZoomIn??

725
2
04-16-2018 05:38 AM
VijitWadhwa
Occasional Contributor

How can i zoomin to a map , by drawing a rectangle on the map and zoom that particular area?? Please Help Michael BranscombAntti KajanusMorten Nielsen@

Thanks in advance,

Vijit

0 Kudos
2 Replies
AnttiKajanus1
Deactivated User

By default, you can hold "Shift" key and then draw a rectangle on the MapView to use similar navigation. If you want to zoom out, you can do "Shift+ Ctrl" combo instead.

If you want to implement your own, then you can do something like this:

 private async void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // use the MapView's Editor to request geometry (Envelope) from the user and await the result
                var newExtent = await myMapView.SketchEditor.StartAsync(Esri.ArcGISRuntime.UI.SketchCreationMode.Rectangle, false);
                // set the map view extent with the Envelope
                await myMapView.SetViewpointGeometryAsync(newExtent);
            }
            catch (TaskCanceledException tce)
            {
                // sketching cancelled 
            }
            catch (Exception ex)
            {
            }
        }
VijitWadhwa
Occasional Contributor

Thankyou Sir.

0 Kudos