// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
namespace Perspex.Input
{
///
/// Defines attached properties that control keyboard navigation behaviour for a container.
///
public static class KeyboardNavigation
{
///
/// Defines the DirectionalNavigation attached property.
///
///
/// The DirectionalNavigation attached property defines how pressing arrow keys causes
/// focus to be navigated between the children of the container.
///
public static readonly AttachedProperty DirectionalNavigationProperty =
PerspexProperty.RegisterAttached(
"DirectionalNavigation",
typeof(KeyboardNavigation),
KeyboardNavigationMode.None);
///
/// Defines the TabNavigation attached property.
///
///
/// The TabNavigation attached property defines how pressing the Tab key causes focus to
/// be navigated between the children of the container.
///
public static readonly AttachedProperty TabNavigationProperty =
PerspexProperty.RegisterAttached(
"TabNavigation",
typeof(KeyboardNavigation));
///
/// Defines the TabOnceActiveElement attached property.
///
///
/// When focus enters a container which has its
/// attached property set to , this property
/// defines to which child the focus should move.
///
public static readonly AttachedProperty TabOnceActiveElementProperty =
PerspexProperty.RegisterAttached(
"TabOnceActiveElement",
typeof(KeyboardNavigation));
///
/// Gets the for a container.
///
/// The container.
/// The for the container.
public static KeyboardNavigationMode GetDirectionalNavigation(InputElement element)
{
return element.GetValue(DirectionalNavigationProperty);
}
///
/// Sets the for a container.
///
/// The container.
/// The for the container.
public static void SetDirectionalNavigation(InputElement element, KeyboardNavigationMode value)
{
element.SetValue(DirectionalNavigationProperty, value);
}
///
/// Gets the for a container.
///
/// The container.
/// The for the container.
public static KeyboardNavigationMode GetTabNavigation(InputElement element)
{
return element.GetValue(TabNavigationProperty);
}
///
/// Sets the for a container.
///
/// The container.
/// The for the container.
public static void SetTabNavigation(InputElement element, KeyboardNavigationMode value)
{
element.SetValue(TabNavigationProperty, value);
}
///
/// Gets the for a container.
///
/// The container.
/// The active element for the container.
public static IInputElement GetTabOnceActiveElement(InputElement element)
{
return element.GetValue(TabOnceActiveElementProperty);
}
///
/// Sets the for a container.
///
/// The container.
/// The active element for the container.
public static void SetTabOnceActiveElement(InputElement element, IInputElement value)
{
element.SetValue(TabOnceActiveElementProperty, value);
}
}
}