fix dropdown scroll fokus
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using C4IT.FASD.Base;
|
||||
using C4IT.MultiLanguage;
|
||||
using FasdDesktopUi.Basics.Helper;
|
||||
using FasdDesktopUi.Basics.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -129,6 +130,19 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
#endregion
|
||||
|
||||
#region RestoreParentScrollFocusOnDropDownClose
|
||||
|
||||
public bool RestoreParentScrollFocusOnDropDownClose
|
||||
{
|
||||
get { return (bool)GetValue(RestoreParentScrollFocusOnDropDownCloseProperty); }
|
||||
set { SetValue(RestoreParentScrollFocusOnDropDownCloseProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty RestoreParentScrollFocusOnDropDownCloseProperty =
|
||||
DependencyProperty.Register("RestoreParentScrollFocusOnDropDownClose", typeof(bool), typeof(ComboBoxPageable), new PropertyMetadata(false));
|
||||
|
||||
#endregion
|
||||
|
||||
#region ItemData
|
||||
|
||||
public ObservableCollection<KeyValuePair<string, object>> ItemData
|
||||
@@ -306,6 +320,28 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
{
|
||||
timer.Stop();
|
||||
cFocusInvoker.InvokeLostFocus(this, e);
|
||||
|
||||
if (RestoreParentScrollFocusOnDropDownClose)
|
||||
{
|
||||
_ = 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);
|
||||
}
|
||||
}
|
||||
|
||||
private void ComboBoxControl_DropDownOpened(object sender, EventArgs e)
|
||||
|
||||
@@ -276,6 +276,7 @@
|
||||
ResetFilterLabel="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ResetFilter.Services}"
|
||||
SelectedItem="{Binding SelectedService, ElementName=CloseCaseDialogUc, Mode=TwoWay}"
|
||||
IsEnabled="{Binding SetOrUpdateServiceInTicket, ElementName=CloseCaseDialogUc}"
|
||||
RestoreParentScrollFocusOnDropDownClose="True"
|
||||
ComboBoxBackground="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
|
||||
BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}"
|
||||
PreviewKeyDown="Combobox_PreviewKeyDown" />
|
||||
|
||||
@@ -2745,13 +2745,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
if (parentBorder != null)
|
||||
cFocusInvoker.InvokeLostFocus(parentBorder, e);
|
||||
|
||||
if (ReferenceEquals(sender, TicketStatusCombobox))
|
||||
{
|
||||
_ = Dispatcher.BeginInvoke(new Action(RestoreDialogFocusAfterTicketActionSelection), System.Windows.Threading.DispatcherPriority.Input);
|
||||
return;
|
||||
}
|
||||
|
||||
DynamicStatusAdditionBorder?.Focus();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -185,6 +185,25 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
Style="{StaticResource MandatoryFieldBorderStyle}">
|
||||
<local:ComboBoxPageable x:Name="RoleSelectionControl"
|
||||
SelectedItem="{Binding ElementName=ForwardTicketDialogUc, Path=SelectedRole, Mode=TwoWay}"
|
||||
RestoreParentScrollFocusOnDropDownClose="True"
|
||||
ComboBoxBackground="{Binding Background, RelativeSource={RelativeSource AncestorType=Border}}"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0" />
|
||||
@@ -38,6 +39,7 @@
|
||||
Style="{StaticResource MandatoryFieldBorderStyle}">
|
||||
<local:ComboBoxPageable x:Name="PersonSelectionControl"
|
||||
SelectedItem="{Binding ElementName=ForwardTicketDialogUc, Path=SelectedPerson, Mode=TwoWay}"
|
||||
RestoreParentScrollFocusOnDropDownClose="True"
|
||||
ComboBoxBackground="{Binding Background, RelativeSource={RelativeSource AncestorType=Border}}"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0" />
|
||||
|
||||
@@ -261,6 +261,25 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user