Search code examples
uwp.net-corebing-mapsuwp-maps

UWP MapControl: How to prevent zoom on MapDoubleTapped?


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).


Solution

  • 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.