From 417d4c8987e48fb553507c21fd0e9f392cca1e34 Mon Sep 17 00:00:00 2001 From: ClemensFischer Date: Wed, 12 Mar 2025 19:23:05 +0100 Subject: [PATCH] Update MapItem.WinUI.cs --- MapControl/WinUI/MapItem.WinUI.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/MapControl/WinUI/MapItem.WinUI.cs b/MapControl/WinUI/MapItem.WinUI.cs index 73c14bb9..cc193396 100644 --- a/MapControl/WinUI/MapItem.WinUI.cs +++ b/MapControl/WinUI/MapItem.WinUI.cs @@ -35,8 +35,19 @@ namespace MapControl protected override void OnPointerPressed(PointerRoutedEventArgs e) { - (ItemsControl.ItemsControlFromItemContainer(this) as MapItemsControl)? - .OnItemClicked(this, e.KeyModifiers.HasFlag(VirtualKeyModifiers.Control)); + // Prevent default handling in ListBoxItem by not calling base.OnPointerPressed. + if (!e.Handled) + { + e.Handled = true; + (ItemsControl.ItemsControlFromItemContainer(this) as MapItemsControl)? + .OnItemClicked(this, e.KeyModifiers.HasFlag(VirtualKeyModifiers.Control)); + } + } + + protected override void OnPointerReleased(PointerRoutedEventArgs e) + { + // Prevent default handling in ListBoxItem by not calling base.OnPointerReleased. + e.Handled = true; } protected override void OnApplyTemplate()