bugfix dropdown closing by ESC

This commit is contained in:
Meik
2026-02-20 16:15:28 +01:00
parent 234eacaecf
commit e154353af8
9 changed files with 86 additions and 235 deletions

View File

@@ -354,6 +354,7 @@ namespace FasdDesktopUi.Basics.UserControls
if (treeViewControl != null)
{
treeViewControl.SelectedItemChanged += TreeViewControl_SelectedItemChanged;
treeViewControl.PreviewKeyDown += DropDownContent_PreviewKeyDown;
treeViewControl.ItemsSource = VisibleItems;
}
}
@@ -362,7 +363,10 @@ namespace FasdDesktopUi.Basics.UserControls
{
searchTextBox = ComboBoxControl.Template.FindName("PART_SearchTextBox", ComboBoxControl) as TextBox;
if (searchTextBox != null)
{
searchTextBox.TextChanged += SearchTextBox_TextChanged;
searchTextBox.PreviewKeyDown += DropDownContent_PreviewKeyDown;
}
}
if (itemsScrollViewer == null)
@@ -408,6 +412,15 @@ namespace FasdDesktopUi.Basics.UserControls
e.Handled = true;
}
private void DropDownContent_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key != Key.Escape)
return;
if (CloseDropDownIfOpen())
e.Handled = true;
}
#endregion
#region Keyboard