From 33fa96e36e55f78a1ba643564174c45d8f1345a8 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Wed, 30 Apr 2025 20:19:22 -0700 Subject: [PATCH] Allow right-click pen to select items on press --- src/Avalonia.Controls/ListBoxItem.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/ListBoxItem.cs b/src/Avalonia.Controls/ListBoxItem.cs index 55fc81653a..da298c219a 100644 --- a/src/Avalonia.Controls/ListBoxItem.cs +++ b/src/Avalonia.Controls/ListBoxItem.cs @@ -64,9 +64,11 @@ namespace Avalonia.Controls if (p.Properties.PointerUpdateKind is PointerUpdateKind.LeftButtonPressed or PointerUpdateKind.RightButtonPressed) { - if (p.Pointer.Type == PointerType.Mouse) + if (p.Pointer.Type == PointerType.Mouse + || (p.Pointer.Type == PointerType.Pen && p.Properties.IsRightButtonPressed)) { - // If the pressed point comes from a mouse, perform the selection immediately. + // If the pressed point comes from a mouse or right-click pen, perform the selection immediately. + // In case of pen, only right-click is accepted, as left click (a tip touch) is used for scrolling. e.Handled = owner.UpdateSelectionFromPointerEvent(this, e); } else