Provides helper methods for traversing and querying the logical tree in headless tests. The logical tree represents the conceptual parent-child relationships as defined in XAML, while the visual tree represents the actual rendered elements including templates.
public static class LogicalTreeTestHelper
kind:method, kind:property, kind:ctor. Press Esc to clear.CompareTreeDepths(Control)Compares logical and visual tree depths for a control. Useful for understanding template expansion.ContainsLogical<T>(ILogical)Checks if a logical contains a descendant of a specific type.ContainsLogicalNamed(ILogical, String)Checks if a logical contains a descendant with a specific name.CountLogical<T>(ILogical)Counts all logical descendants of a specific type.FindAllLogical<T>(ILogical, Boolean)Finds all logical descendants of a specific type.FindAllLogical<T>(ILogical, Func<T, Boolean>, Boolean)Finds all logical descendants matching a predicate.FindFirstLogical<T>(ILogical, Boolean)Finds the first logical descendant of a specific type.FindFirstLogical<T>(ILogical, Func<T, Boolean>, Boolean)Finds the first logical descendant matching a predicate.FindLogicalAncestor<T>(ILogical, Boolean)Finds the first logical ancestor of a specific type.FindLogicalAncestor<T>(ILogical, Func<T, Boolean>, Boolean)Finds a logical ancestor matching a predicate.FindLogicalByClass<T>(ILogical, String)Finds logical controls by CSS classes.FindLogicalByName(ILogical, String)Finds a control by its Name property in the logical tree.FindLogicalByName<T>(ILogical, String)Finds a control by its Name property with a specific type in the logical tree.FindLogicalByProperty<T, TProperty>(ILogical, AvaloniaProperty<TProperty>, TProperty)Finds logical controls by a specific property value.FindLogicalByTag(ILogical, Object)Finds logical controls by Tag property.FindLogicalDisabled<T>(ILogical)Finds all disabled controls of a specific type in the logical tree.FindLogicalEnabled<T>(ILogical)Finds all enabled controls of a specific type in the logical tree.FindLogicalVisible<T>(ILogical)Finds all visible controls of a specific type in the logical tree.GetContent<T>(ContentControl)Gets the content of a ContentControl in the logical tree.GetDetailedLogicalPathString(ILogical)Gets a detailed logical path string including names where available.GetFirstLogicalChild<T>(ILogical)Gets the first logical child of a specific type.GetItemAt<T>(ItemsControl, Int32)Gets an item at a specific index from an ItemsControl.GetItemCount(ItemsControl)Gets the item count from an ItemsControl.GetItems<T>(ItemsControl)Gets all items from an ItemsControl as a typed enumerable.GetLastLogicalChild<T>(ILogical)Gets the last logical child of a specific type.GetLogicalAncestors<T>(ILogical)Gets all logical ancestors of a specific type.GetLogicalByName<T>(ILogical, String)Gets a control by name in the logical tree, throwing if not found.GetLogicalChildAt(ILogical, Int32)Gets a logical child at a specific index.GetLogicalChildAt<T>(ILogical, Int32)Gets a logical child at a specific index, cast to a type.GetLogicalChildCount(ILogical)Gets the number of direct logical children.GetLogicalChildren<T>(ILogical)Gets the direct logical children of a specific type.GetLogicalDescendantCount(ILogical)Gets the number of logical descendants (all levels).GetLogicalNamedControls(ILogical)Gets all named controls in the logical tree.GetLogicalPathFromRoot(ILogical)Gets the logical path from root to the specified logical.GetLogicalPathString(ILogical)Gets the logical path as type names for debugging.GetLogicalSiblingIndex(ILogical)Gets the index of this logical among its siblings.GetLogicalSiblings<T>(ILogical)Gets the logical siblings of a specific type (excluding self).GetLogicalTypeSummary(ILogical)Gets a summary of control types in the logical tree.GetNextLogicalSibling<T>(ILogical)Gets the next sibling of a specific type.GetPreviousLogicalSibling<T>(ILogical)Gets the previous sibling of a specific type.HasLogicalAncestor<T>(ILogical)Checks if the logical has an ancestor of a specific type.IsFirstLogicalChild(ILogical)Checks if this is the first child of its parent.IsLastLogicalChild(ILogical)Checks if this is the last child of its parent.IsOnlyLogicalChild(ILogical)Checks if this logical is an only child.MatchesLogicalStructure(ILogical, Type[])Checks if the logical tree structure matches expected types at each level.PrintLogicalTree(ILogical, Int32)Prints the logical tree structure to a string for debugging.