I need to catch a double click/tap event on a map polygon in order to show an "edit properties" dialog. How can I prevent the map zoom on double tap (on a polygon)? There is no e.Handled property available. The map must still be zoomable by double tapping on free space (no polygon).
Asked
Active
Viewed 278 times
2 Answers
2
Here is an example of how you can disable the zooming when double clicking:
MyMapControl.MapDoubleTapped += MyMapControl_MapDoubleTapped;
private void MyMapControl_MapDoubleTapped(MapControl sender, MapInputEventArgs args)
{
var currentCamera = sender.ActualCamera;
sender.TrySetSceneAsync(MapScene.CreateFromCamera(currentCamera));
}
If you only want to disable this when a polygon is double tapped. Try using setting the scene in your polygon double tap event handler.

rbrundritt
- 16,570
- 2
- 21
- 46
-
It works for zoom levels < ~10.6, with higher zoom levels it zooms on double tap again! – IngoB Jun 12 '17 at 17:03
0
this should work in all zoom levels
private async void OnMapDoubleTapped(MapControl sender, MapInputEventArgs args)
{
double zoom = sender.ZoomLevel;
var camera= sender.ActualCamera;
await sender.TrySetViewAsync(camera.Location, zoom);
}

user3136572
- 134
- 10