Browse Source

Moved Tab key handling to InputElement.

pull/39/head
Steven Kirk 12 years ago
parent
commit
78a80b2b75
  1. 10
      Perspex.Controls/Presenters/TextPresenter.cs
  2. 14
      Perspex.Input/InputElement.cs

10
Perspex.Controls/Presenters/TextPresenter.cs

@ -287,16 +287,6 @@ namespace Perspex.Controls.Presenters
{
goto default;
}
else if ((modifiers & ModifierKeys.Shift) == 0)
{
// TODO: Keyboard navigation should be moved to InputElement. This is just a
// hack to get TextBox tab navigation working.
KeyboardNavigation.MoveNext((IInputElement)this.TemplatedParent);
}
else
{
KeyboardNavigation.MovePrevious((IInputElement)this.TemplatedParent);
}
break;

14
Perspex.Input/InputElement.cs

@ -9,7 +9,6 @@ namespace Perspex.Input
using System;
using System.Linq;
using Perspex.Interactivity;
using Perspex.Rendering;
using Perspex.VisualTree;
public class InputElement : Interactive, IInputElement
@ -200,6 +199,19 @@ namespace Perspex.Input
protected virtual void OnKeyDown(KeyEventArgs e)
{
if (e.Key == Key.Tab)
{
var modifiers = e.Device.Modifiers;
if ((modifiers & ModifierKeys.Shift) == 0)
{
KeyboardNavigation.MoveNext(this);
}
else
{
KeyboardNavigation.MovePrevious(this);
}
}
}
protected virtual void OnPointerEnter(PointerEventArgs e)

Loading…
Cancel
Save