FindLogicalAncestor(ILogical, Func<T, Boolean>, Boolean) Method

Definition

Assembly HeadlessTestingFramework.dll

Finds a logical ancestor matching a predicate.

public static T? FindLogicalAncestor<T>(this ILogical logical, Func<T, bool> predicate, bool includeSelf = false)
    where T : class

Type parameters

T
The type of ancestor to find.

Parameters

logical
Avalonia.LogicalTree.ILogical

The logical to start from.

predicate
Func<T, Boolean>

The predicate to match.

includeSelf
Boolean

Whether to include the logical itself in the search.

Returns

{T}
The first ancestor matching the predicate, or null if not found.