fix dropdown scroll fokus

This commit is contained in:
Meik
2026-02-09 19:55:29 +01:00
parent 820a6ad3f3
commit ca584d3929
6 changed files with 127 additions and 56 deletions

View File

@@ -176,20 +176,39 @@ namespace FasdDesktopUi.Basics.UserControls
}
}
private void DropDownClosed(object sender, EventArgs e)
{
try
{
if (!(sender is FrameworkElement senderElement))
return;
ErrorTypeValueChanged?.Invoke(this, EventArgs.Empty);
var parentBorder = cUiElementHelper.GetFirstParentOfType<Border>(senderElement);
cFocusInvoker.InvokeLostFocus(parentBorder, e);
}
catch (Exception E)
{
LogException(E);
}
private void DropDownClosed(object sender, EventArgs e)
{
try
{
if (!(sender is FrameworkElement senderElement))
return;
ErrorTypeValueChanged?.Invoke(this, EventArgs.Empty);
var parentBorder = cUiElementHelper.GetFirstParentOfType<Border>(senderElement);
cFocusInvoker.InvokeLostFocus(parentBorder, e);
_ = Dispatcher.BeginInvoke((Action)(() =>
{
try
{
var parentScrollViewer = cUiElementHelper.GetFirstParentOfType<ScrollViewer>(this);
Keyboard.ClearFocus();
if (parentScrollViewer != null)
{
parentScrollViewer.Focus();
Keyboard.Focus(parentScrollViewer);
}
}
catch (Exception exception)
{
LogException(exception);
}
}), System.Windows.Threading.DispatcherPriority.Input);
}
catch (Exception E)
{
LogException(E);
}
}