FindAncestor(Visual, Func<T, Boolean>, Boolean) Method

Definition

Assembly HeadlessTestingFramework.dll

Finds an ancestor matching a predicate.

public static T? FindAncestor<T>(this Visual visual, Func<T, bool> predicate, bool includeSelf = false)
    where T : class

Type parameters

T
The type of ancestor to find.

Parameters

visual
Avalonia.Visual

The visual to start from.

predicate
Func<T, Boolean>

The predicate to match.

includeSelf
Boolean

Whether to include the visual itself in the search.

Returns

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