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