Skip to main content

IsVisualAncestorOf Method

Tests whether an Visual is an ancestor of another visual.

Definition​

Namespace: Avalonia.VisualTree
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public static bool IsVisualAncestorOf(
this Visual? visual,
Visual target
)

Parameters​

  Visual
The visual.
  Visual
The potential descendant.

Return Value​

Boolean
True if visual is an ancestor of target; otherwise false.

Usage Note​

In Visual Basic and C#, you can call this method as an instance method on any object of type Visual. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also​

Reference​

VisualExtensions Class
Avalonia.VisualTree Namespace