FindAncestor(Visual, Boolean) Method

Definition

Assembly HeadlessTestingFramework.dll

Finds the first ancestor of a specific type.

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

Type parameters

T
The type of ancestor to find.

Parameters

visual
Avalonia.Visual

The visual to start from.

includeSelf
Boolean

Whether to include the visual itself in the search.

Returns

{T}
The first ancestor of the specified type, or null if not found.