namespace Avalonia.Input.Navigation { /// /// Provides extension methods relating to control focus. /// internal static class FocusExtensions { /// /// Checks if the specified element can be focused. /// /// The element. /// True if the element can be focused. public static bool CanFocus(this IInputElement e) { var visible = (e as Visual)?.IsVisible ?? true; return e.Focusable && e.IsEffectivelyEnabled && visible; } /// /// Checks if descendants of the specified element can be focused. /// /// The element. /// True if descendants of the element can be focused. public static bool CanFocusDescendants(this IInputElement e) { var visible = (e as Visual)?.IsVisible ?? true; return e.IsEffectivelyEnabled && visible; } } }