Fix ESC handling in ticket completion dropdowns

This commit is contained in:
Meik
2026-02-20 14:55:35 +01:00
parent dd0e7bdc99
commit 234eacaecf
4 changed files with 3489 additions and 3422 deletions

View File

@@ -222,6 +222,15 @@ namespace FasdDesktopUi.Basics.UserControls
return null;
}
public bool CloseDropDownIfOpen()
{
if (ComboBoxControl?.IsDropDownOpen != true)
return false;
ComboBoxControl.IsDropDownOpen = false;
return true;
}
#region Paging Events
#region PageBack

View File

@@ -34,6 +34,15 @@ namespace FasdDesktopUi.Basics.UserControls
searchDelayTimer.Tick += SearchDelayTimer_Tick;
}
public bool CloseDropDownIfOpen()
{
if (ComboBoxControl?.IsDropDownOpen != true)
return false;
ComboBoxControl.IsDropDownOpen = false;
return true;
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();

View File

@@ -2665,6 +2665,48 @@ namespace FasdDesktopUi.Basics.UserControls
#region DropDown
private static bool IsInsidePageable(FrameworkElement fe) => cUiElementHelper.GetFirstParentOfType<ComboBoxPageable>(fe) != null;
public bool TryHandleEscapeKey()
{
try
{
if (TicketSelectionPopUp?.IsOpen == true)
{
TicketSelectionPopUp.IsOpen = false;
return true;
}
if (QuickTicketSelection?.IsDropDownOpen == true)
{
QuickTicketSelection.IsDropDownOpen = false;
return true;
}
if (CategorySelectionControl?.CloseDropDownIfOpen() == true)
return true;
if (ComputerSelection?.IsDropDownOpen == true)
{
ComputerSelection.IsDropDownOpen = false;
return true;
}
if (ServiceSelectionControl?.CloseDropDownIfOpen() == true)
return true;
if (TicketStatusCombobox?.IsDropDownOpen == true)
{
TicketStatusCombobox.IsDropDownOpen = false;
return true;
}
}
catch (Exception E)
{
LogException(E);
}
return false;
}
private void DropDownOpened(object sender, EventArgs e)
{
if (!(sender is FrameworkElement fe)) return;

View File

@@ -285,7 +285,14 @@ namespace FasdDesktopUi.Pages.TicketCompletion
switch (e.Key)
{
case Key.Escape:
if (CloseCaseDialogUc?.TryHandleEscapeKey() == true)
{
e.Handled = true;
return;
}
Close_Click();
e.Handled = true;
break;
}
}