csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
4.4 KiB
105 lines
4.4 KiB
namespace Avalonia.Input
|
|
{
|
|
/// <summary>
|
|
/// Defines attached properties that control keyboard navigation behaviour for a container.
|
|
/// </summary>
|
|
public static class KeyboardNavigation
|
|
{
|
|
/// <summary>
|
|
/// Defines the TabNavigation attached property.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The TabNavigation attached property defines how pressing the Tab key causes focus to
|
|
/// be navigated between the children of the container.
|
|
/// </remarks>
|
|
public static readonly AttachedProperty<KeyboardNavigationMode> TabNavigationProperty =
|
|
AvaloniaProperty.RegisterAttached<InputElement, KeyboardNavigationMode>(
|
|
"TabNavigation",
|
|
typeof(KeyboardNavigation));
|
|
|
|
/// <summary>
|
|
/// Defines the TabOnceActiveElement attached property.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// When focus enters a container which has its <see cref="TabNavigationProperty"/>
|
|
/// attached property set to <see cref="KeyboardNavigationMode.Once"/>, this property
|
|
/// defines to which child the focus should move.
|
|
/// </remarks>
|
|
public static readonly AttachedProperty<IInputElement?> TabOnceActiveElementProperty =
|
|
AvaloniaProperty.RegisterAttached<InputElement, IInputElement?>(
|
|
"TabOnceActiveElement",
|
|
typeof(KeyboardNavigation));
|
|
|
|
/// <summary>
|
|
/// Defines the IsTabStop attached property.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The IsTabStop attached property determines whether the control is focusable by tab navigation.
|
|
/// </remarks>
|
|
public static readonly AttachedProperty<bool> IsTabStopProperty =
|
|
AvaloniaProperty.RegisterAttached<InputElement, bool>(
|
|
"IsTabStop",
|
|
typeof(KeyboardNavigation),
|
|
true);
|
|
|
|
/// <summary>
|
|
/// Gets the <see cref="TabNavigationProperty"/> for a container.
|
|
/// </summary>
|
|
/// <param name="element">The container.</param>
|
|
/// <returns>The <see cref="KeyboardNavigationMode"/> for the container.</returns>
|
|
public static KeyboardNavigationMode GetTabNavigation(InputElement element)
|
|
{
|
|
return element.GetValue(TabNavigationProperty);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets the <see cref="TabNavigationProperty"/> for a container.
|
|
/// </summary>
|
|
/// <param name="element">The container.</param>
|
|
/// <param name="value">The <see cref="KeyboardNavigationMode"/> for the container.</param>
|
|
public static void SetTabNavigation(InputElement element, KeyboardNavigationMode value)
|
|
{
|
|
element.SetValue(TabNavigationProperty, value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the <see cref="TabOnceActiveElementProperty"/> for a container.
|
|
/// </summary>
|
|
/// <param name="element">The container.</param>
|
|
/// <returns>The active element for the container.</returns>
|
|
public static IInputElement? GetTabOnceActiveElement(InputElement element)
|
|
{
|
|
return element.GetValue(TabOnceActiveElementProperty);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets the <see cref="TabOnceActiveElementProperty"/> for a container.
|
|
/// </summary>
|
|
/// <param name="element">The container.</param>
|
|
/// <param name="value">The active element for the container.</param>
|
|
public static void SetTabOnceActiveElement(InputElement element, IInputElement? value)
|
|
{
|
|
element.SetValue(TabOnceActiveElementProperty, value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets the <see cref="IsTabStopProperty"/> for a container.
|
|
/// </summary>
|
|
/// <param name="element">The container.</param>
|
|
/// <param name="value">Value indicating whether the container is a tab stop.</param>
|
|
public static void SetIsTabStop(InputElement element, bool value)
|
|
{
|
|
element.SetValue(IsTabStopProperty, value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the <see cref="IsTabStopProperty"/> for a container.
|
|
/// </summary>
|
|
/// <param name="element">The container.</param>
|
|
/// <returns>Whether the container is a tab stop.</returns>
|
|
public static bool GetIsTabStop(InputElement element)
|
|
{
|
|
return element.GetValue(IsTabStopProperty);
|
|
}
|
|
}
|
|
}
|
|
|