-
Home
-
API
-
Avalonia.HeadlessTestingFramework
-
VisualTreeTestHelper
-
Methods
-
FindAncestor(Visual, Func, Boolean)
FindAncestor(Visual, Func<T, Boolean>, Boolean) Method
Definition
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
- includeSelf
- Boolean
Whether to include the visual itself in the search.
Returns
- {T}
- The first ancestor matching the predicate, or null if not found.