fix: fix input issue taping Tab Key and remove FocusAdorner.
This commit is contained in:
@@ -5,14 +5,14 @@
|
||||
<Design.PreviewWith>
|
||||
<u:PinCode Count="4" />
|
||||
</Design.PreviewWith>
|
||||
<!-- Add Resources Here -->
|
||||
<ControlTheme x:Key="{x:Type u:PinCodeItem}" TargetType="u:PinCodeItem">
|
||||
<Setter Property="Focusable" Value="True" />
|
||||
<Setter Property="Height" Value="{DynamicResource TextBoxDefaultHeight}" />
|
||||
<Setter Property="Width" Value="{DynamicResource TextBoxDefaultHeight}" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource TextBoxDefaultCornerRadius}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource TextBoxBorderThickness}" />
|
||||
<Setter Property="Background" Value="{DynamicResource TextBoxDefaultBackground}"></Setter>
|
||||
<Setter Property="Background" Value="{DynamicResource TextBoxDefaultBackground}" />
|
||||
<Setter Property="FocusAdorner" Value="{x:Null}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Border
|
||||
@@ -64,7 +64,6 @@
|
||||
|
||||
<ControlTheme x:Key="{x:Type u:PinCode}" TargetType="u:PinCode">
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:PinCode">
|
||||
<DataValidationErrors>
|
||||
|
||||
@@ -159,6 +159,15 @@ public class PinCode: TemplatedControl
|
||||
|
||||
protected override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Tab && e.Source is PinCodeItem)
|
||||
{
|
||||
_currentIndex = MathHelpers.SafeClamp(_currentIndex, 0, Count - 1);
|
||||
if (e.KeyModifiers == KeyModifiers.Shift)
|
||||
_currentIndex--;
|
||||
else
|
||||
_currentIndex++;
|
||||
_currentIndex = MathHelpers.SafeClamp(_currentIndex, 0, Count - 1);
|
||||
}
|
||||
base.OnKeyDown(e);
|
||||
if (e.Key == Key.Back && _currentIndex >= 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user