Browse Source
Merge pull request #9737 from robloo/combobox-space-enter
Open/Close ComboBox drop-down with Enter and Space
pull/9752/head
Max Katz
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
1 deletions
-
src/Avalonia.Controls/ComboBox.cs
|
|
|
@ -213,7 +213,12 @@ namespace Avalonia.Controls |
|
|
|
IsDropDownOpen = false; |
|
|
|
e.Handled = true; |
|
|
|
} |
|
|
|
else if (IsDropDownOpen && e.Key == Key.Enter) |
|
|
|
else if (!IsDropDownOpen && (e.Key == Key.Enter || e.Key == Key.Space)) |
|
|
|
{ |
|
|
|
IsDropDownOpen = true; |
|
|
|
e.Handled = true; |
|
|
|
} |
|
|
|
else if (IsDropDownOpen && (e.Key == Key.Enter || e.Key == Key.Space)) |
|
|
|
{ |
|
|
|
SelectFocusedItem(); |
|
|
|
IsDropDownOpen = false; |
|
|
|
|