/// <summary> /// Walks the visual tree to determine if the currently focused element is contained within /// a parent AvaloniaObject. The FocusManager's Current property is used to determine /// the currently focused element, which is updated synchronously. /// </summary> /// <param name="element">Parent Visual</param> /// <returns>True if the currently focused element is within the visual tree of the parent</returns> internal static bool ContainsFocusedElement(this IVisual element) { return((element == null) ? false : element.ContainsChild(FocusManager.Instance.Current)); }