Browse Source

Don't handle keypresses in TabControl.

pull/58/head
Steven Kirk 11 years ago
parent
commit
5da890fbfb
  1. 53
      Perspex.Controls/Primitives/SelectingItemsControl.cs
  2. 6
      Perspex.Controls/TabControl.cs

53
Perspex.Controls/Primitives/SelectingItemsControl.cs

@ -90,37 +90,40 @@ namespace Perspex.Controls.Primitives
{ {
base.OnKeyDown(e); base.OnKeyDown(e);
switch (e.Key) if (!e.Handled)
{ {
case Key.Up: switch (e.Key)
this.MoveSelection(FocusNavigationDirection.Up); {
break; case Key.Up:
case Key.Down: this.MoveSelection(FocusNavigationDirection.Up);
this.MoveSelection(FocusNavigationDirection.Down); break;
break; case Key.Down:
case Key.Left: this.MoveSelection(FocusNavigationDirection.Down);
this.MoveSelection(FocusNavigationDirection.Left); break;
break; case Key.Left:
case Key.Right: this.MoveSelection(FocusNavigationDirection.Left);
this.MoveSelection(FocusNavigationDirection.Right); break;
break; case Key.Right:
default: this.MoveSelection(FocusNavigationDirection.Right);
return; break;
} default:
return;
var selected = this.SelectedItem; }
if (selected != null) var selected = this.SelectedItem;
{
var container = this.ItemContainerGenerator.GetContainerForItem(selected);
if (container != null) if (selected != null)
{ {
FocusManager.Instance.Focus(container, true); var container = this.ItemContainerGenerator.GetContainerForItem(selected);
if (container != null)
{
FocusManager.Instance.Focus(container, true);
}
} }
}
e.Handled = true; e.Handled = true;
}
} }
protected override void OnPointerPressed(PointerPressEventArgs e) protected override void OnPointerPressed(PointerPressEventArgs e)

6
Perspex.Controls/TabControl.cs

@ -14,6 +14,7 @@ namespace Perspex.Controls
using Perspex.Controls.Presenters; using Perspex.Controls.Presenters;
using Perspex.Controls.Primitives; using Perspex.Controls.Primitives;
using Perspex.Controls.Templates; using Perspex.Controls.Templates;
using Perspex.Input;
public class TabControl : SelectingItemsControl, ILogical public class TabControl : SelectingItemsControl, ILogical
{ {
@ -60,6 +61,11 @@ namespace Perspex.Controls
get { return this.logicalChildren; } get { return this.logicalChildren; }
} }
protected override void OnKeyDown(KeyEventArgs e)
{
// Don't handle keypresses.
}
protected override void OnTemplateApplied() protected override void OnTemplateApplied()
{ {
var presenter = this.GetTemplateChild<ContentPresenter>("contentPresenter"); var presenter = this.GetTemplateChild<ContentPresenter>("contentPresenter");

Loading…
Cancel
Save