VisualExtensions.

FindAncestorOfType<T>(IVisual, bool) Method

Summary

Finds first ancestor of given type.
Namespace
Avalonia.VisualTree
Containing Type
VisualExtensions

Syntax

public static T FindAncestorOfType<T>(this IVisual visual, bool includeSelf = false) where T : class

Type Parameters

Name Description
T Ancestor type.

Parameters

Name Type Description
visual IVisual The visual.
includeSelf bool If given visual should be included in search.

Return Value

Type Description
T First ancestor of given type.