fix dropdown scroll fokus
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using C4IT.FASD.Base;
|
using C4IT.FASD.Base;
|
||||||
using C4IT.MultiLanguage;
|
using C4IT.MultiLanguage;
|
||||||
using FasdDesktopUi.Basics.Models;
|
using FasdDesktopUi.Basics.Helper;
|
||||||
|
using FasdDesktopUi.Basics.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
@@ -124,12 +125,25 @@ namespace FasdDesktopUi.Basics.UserControls
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static readonly DependencyProperty SearchDataChangedProperty =
|
public static readonly DependencyProperty SearchDataChangedProperty =
|
||||||
DependencyProperty.Register("SearchDataChanged", typeof(EventHandler<cF4sdHealthSelectionDataRequest>), typeof(ComboBoxPageable), new PropertyMetadata(null));
|
DependencyProperty.Register("SearchDataChanged", typeof(EventHandler<cF4sdHealthSelectionDataRequest>), typeof(ComboBoxPageable), new PropertyMetadata(null));
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ItemData
|
#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
|
public ObservableCollection<KeyValuePair<string, object>> ItemData
|
||||||
{
|
{
|
||||||
@@ -302,11 +316,33 @@ namespace FasdDesktopUi.Basics.UserControls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ComboBoxControl_DropDownClosed(object sender, EventArgs e)
|
private void ComboBoxControl_DropDownClosed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
cFocusInvoker.InvokeLostFocus(this, e);
|
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)
|
private void ComboBoxControl_DropDownOpened(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -271,14 +271,15 @@
|
|||||||
SelectedInternIcon="status_bad"
|
SelectedInternIcon="status_bad"
|
||||||
VerticalAlignment="Bottom" />
|
VerticalAlignment="Bottom" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<local:ComboBoxPageable x:Name="ServiceSelectionControl"
|
<local:ComboBoxPageable x:Name="ServiceSelectionControl"
|
||||||
Margin="0 5 0 0"
|
Margin="0 5 0 0"
|
||||||
ResetFilterLabel="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ResetFilter.Services}"
|
ResetFilterLabel="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ResetFilter.Services}"
|
||||||
SelectedItem="{Binding SelectedService, ElementName=CloseCaseDialogUc, Mode=TwoWay}"
|
SelectedItem="{Binding SelectedService, ElementName=CloseCaseDialogUc, Mode=TwoWay}"
|
||||||
IsEnabled="{Binding SetOrUpdateServiceInTicket, ElementName=CloseCaseDialogUc}"
|
IsEnabled="{Binding SetOrUpdateServiceInTicket, ElementName=CloseCaseDialogUc}"
|
||||||
ComboBoxBackground="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
|
RestoreParentScrollFocusOnDropDownClose="True"
|
||||||
BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}"
|
ComboBoxBackground="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
|
||||||
PreviewKeyDown="Combobox_PreviewKeyDown" />
|
BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}"
|
||||||
|
PreviewKeyDown="Combobox_PreviewKeyDown" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
|
|||||||
@@ -2745,13 +2745,7 @@ namespace FasdDesktopUi.Basics.UserControls
|
|||||||
if (parentBorder != null)
|
if (parentBorder != null)
|
||||||
cFocusInvoker.InvokeLostFocus(parentBorder, e);
|
cFocusInvoker.InvokeLostFocus(parentBorder, e);
|
||||||
|
|
||||||
if (ReferenceEquals(sender, TicketStatusCombobox))
|
_ = Dispatcher.BeginInvoke(new Action(RestoreDialogFocusAfterTicketActionSelection), System.Windows.Threading.DispatcherPriority.Input);
|
||||||
{
|
|
||||||
_ = Dispatcher.BeginInvoke(new Action(RestoreDialogFocusAfterTicketActionSelection), System.Windows.Threading.DispatcherPriority.Input);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DynamicStatusAdditionBorder?.Focus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -176,20 +176,39 @@ namespace FasdDesktopUi.Basics.UserControls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DropDownClosed(object sender, EventArgs e)
|
private void DropDownClosed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!(sender is FrameworkElement senderElement))
|
if (!(sender is FrameworkElement senderElement))
|
||||||
return;
|
return;
|
||||||
ErrorTypeValueChanged?.Invoke(this, EventArgs.Empty);
|
ErrorTypeValueChanged?.Invoke(this, EventArgs.Empty);
|
||||||
var parentBorder = cUiElementHelper.GetFirstParentOfType<Border>(senderElement);
|
var parentBorder = cUiElementHelper.GetFirstParentOfType<Border>(senderElement);
|
||||||
cFocusInvoker.InvokeLostFocus(parentBorder, e);
|
cFocusInvoker.InvokeLostFocus(parentBorder, e);
|
||||||
}
|
|
||||||
catch (Exception E)
|
_ = Dispatcher.BeginInvoke((Action)(() =>
|
||||||
{
|
{
|
||||||
LogException(E);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
Style="{StaticResource MandatoryFieldBorderStyle}">
|
Style="{StaticResource MandatoryFieldBorderStyle}">
|
||||||
<local:ComboBoxPageable x:Name="RoleSelectionControl"
|
<local:ComboBoxPageable x:Name="RoleSelectionControl"
|
||||||
SelectedItem="{Binding ElementName=ForwardTicketDialogUc, Path=SelectedRole, Mode=TwoWay}"
|
SelectedItem="{Binding ElementName=ForwardTicketDialogUc, Path=SelectedRole, Mode=TwoWay}"
|
||||||
|
RestoreParentScrollFocusOnDropDownClose="True"
|
||||||
ComboBoxBackground="{Binding Background, RelativeSource={RelativeSource AncestorType=Border}}"
|
ComboBoxBackground="{Binding Background, RelativeSource={RelativeSource AncestorType=Border}}"
|
||||||
BorderBrush="Transparent"
|
BorderBrush="Transparent"
|
||||||
BorderThickness="0" />
|
BorderThickness="0" />
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
Style="{StaticResource MandatoryFieldBorderStyle}">
|
Style="{StaticResource MandatoryFieldBorderStyle}">
|
||||||
<local:ComboBoxPageable x:Name="PersonSelectionControl"
|
<local:ComboBoxPageable x:Name="PersonSelectionControl"
|
||||||
SelectedItem="{Binding ElementName=ForwardTicketDialogUc, Path=SelectedPerson, Mode=TwoWay}"
|
SelectedItem="{Binding ElementName=ForwardTicketDialogUc, Path=SelectedPerson, Mode=TwoWay}"
|
||||||
|
RestoreParentScrollFocusOnDropDownClose="True"
|
||||||
ComboBoxBackground="{Binding Background, RelativeSource={RelativeSource AncestorType=Border}}"
|
ComboBoxBackground="{Binding Background, RelativeSource={RelativeSource AncestorType=Border}}"
|
||||||
BorderBrush="Transparent"
|
BorderBrush="Transparent"
|
||||||
BorderThickness="0" />
|
BorderThickness="0" />
|
||||||
|
|||||||
@@ -252,20 +252,39 @@ namespace FasdDesktopUi.Basics.UserControls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DropDownClosed(object sender, EventArgs e)
|
private void DropDownClosed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!(sender is FrameworkElement senderElement))
|
if (!(sender is FrameworkElement senderElement))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var parentBorder = cUiElementHelper.GetFirstParentOfType<Border>(senderElement);
|
var parentBorder = cUiElementHelper.GetFirstParentOfType<Border>(senderElement);
|
||||||
cFocusInvoker.InvokeLostFocus(parentBorder, e);
|
cFocusInvoker.InvokeLostFocus(parentBorder, e);
|
||||||
}
|
|
||||||
catch (Exception E)
|
_ = Dispatcher.BeginInvoke((Action)(() =>
|
||||||
{
|
{
|
||||||
LogException(E);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|||||||
Reference in New Issue
Block a user