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);
switch (e.Key)
if (!e.Handled)
{
case Key.Up:
this.MoveSelection(FocusNavigationDirection.Up);
break;
case Key.Down:
this.MoveSelection(FocusNavigationDirection.Down);
break;
case Key.Left:
this.MoveSelection(FocusNavigationDirection.Left);
break;
case Key.Right:
this.MoveSelection(FocusNavigationDirection.Right);
break;
default:
return;
}
var selected = this.SelectedItem;
switch (e.Key)
{
case Key.Up:
this.MoveSelection(FocusNavigationDirection.Up);
break;
case Key.Down:
this.MoveSelection(FocusNavigationDirection.Down);
break;
case Key.Left:
this.MoveSelection(FocusNavigationDirection.Left);
break;
case Key.Right:
this.MoveSelection(FocusNavigationDirection.Right);
break;
default:
return;
}
if (selected != null)
{
var container = this.ItemContainerGenerator.GetContainerForItem(selected);
var selected = this.SelectedItem;
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)

6
Perspex.Controls/TabControl.cs

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

Loading…
Cancel
Save