From e3d7d477538bec919957c92498589bf189929a2e Mon Sep 17 00:00:00 2001 From: MonkAlex <3amepob@gmail.com> Date: Fri, 8 Mar 2019 18:43:54 +0400 Subject: [PATCH] #2355 Ctrl+A hotkey for SelectingItemsControl --- .../Primitives/SelectingItemsControl.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs b/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs index a54bb502c0..f5dcbf9186 100644 --- a/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs +++ b/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs @@ -459,6 +459,23 @@ namespace Avalonia.Controls.Primitives } } + /// + /// Handles 'select all' (Ctrl+A) in . + /// + /// The key events. + protected override void OnKeyDown(KeyEventArgs e) + { + base.OnKeyDown(e); + + if (!e.Handled) + { + if (this.SelectionMode == SelectionMode.Multiple && e.Key == Key.A && e.Modifiers == InputModifiers.Control) + { + SynchronizeItems(SelectedItems, Items?.Cast()); + } + } + } + /// /// Moves the selection in the specified direction relative to the current selection. ///