MapItem mouse/pointer event handling

This commit is contained in:
ClemensFischer 2025-03-12 19:45:08 +01:00
parent 417d4c8987
commit fc242ee7a4
3 changed files with 27 additions and 11 deletions

View file

@ -33,9 +33,14 @@ namespace MapControl
MapPanel.InitMapElement(this);
}
/// <summary>
/// Replaces ListBoxItem pointer event handling by not calling base.OnPointerPressed.
/// Setting e.Handled = true generates a PointerReleased event in the parent MapItemsControl,
/// which differs from the behavior of the ListBox base class, where neither a PointerPressed
/// nor a PointerReleased is generated.
/// </summary>
protected override void OnPointerPressed(PointerRoutedEventArgs e)
{
// Prevent default handling in ListBoxItem by not calling base.OnPointerPressed.
if (!e.Handled)
{
e.Handled = true;
@ -44,12 +49,6 @@ namespace MapControl
}
}
protected override void OnPointerReleased(PointerRoutedEventArgs e)
{
// Prevent default handling in ListBoxItem by not calling base.OnPointerReleased.
e.Handled = true;
}
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();