diff --git a/Perspex.Controls/Primitives/SelectingItemsControl.cs b/Perspex.Controls/Primitives/SelectingItemsControl.cs index c7a5bdbe8d..954107d658 100644 --- a/Perspex.Controls/Primitives/SelectingItemsControl.cs +++ b/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) diff --git a/Perspex.Controls/TabControl.cs b/Perspex.Controls/TabControl.cs index 2812a59752..f7d109c50d 100644 --- a/Perspex.Controls/TabControl.cs +++ b/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");