VisualExtensions Class

Summary

Provides extension methods for working with the visual tree.
Namespace
Avalonia.VisualTree
Base Types
  • object
graph BT Type-->Base0["object"] Type["VisualExtensions"] class Type type-node

Syntax

public static class VisualExtensions

Methods

Name Value Summary
CalculateDistanceFromAncestor(IVisual, IVisual) int
Calculates the distance from a visual's ancestor.
static
CalculateDistanceFromRoot(IVisual) int
Calculates the distance from a visual's root.
static
FindAncestorOfType<T>(IVisual, bool) T
Finds first ancestor of given type.
static
FindCommonVisualAncestor(IVisual, IVisual) IVisual
Tries to get the first common ancestor of two visuals.
static
FindDescendantOfType<T>(IVisual, bool) T
Finds first descendant of given type.
static
GetSelfAndVisualAncestors(IVisual) IEnumerable<IVisual>
Enumerates an IVisual and its ancestors in the visual tree.
static
GetSelfAndVisualDescendants(IVisual) IEnumerable<IVisual>
Enumerates an IVisual and its descendants in the visual tree.
static
GetVisualAncestors(IVisual) IEnumerable<IVisual>
Enumerates the ancestors of an IVisual in the visual tree.
static
GetVisualAt(IVisual, Point) IVisual
Gets the first visual in the visual tree whose bounds contain a point.
static
GetVisualAt(IVisual, Point, Func<IVisual, bool>) IVisual
Gets the first visual in the visual tree whose bounds contain a point.
static
GetVisualChildren(IVisual) IEnumerable<IVisual>
Enumerates the children of an IVisual in the visual tree.
static
GetVisualDescendants(IVisual) IEnumerable<IVisual>
Enumerates the descendants of an IVisual in the visual tree.
static
GetVisualParent(IVisual) IVisual
Gets the visual parent of an IVisual.
static
GetVisualParent<T>(IVisual) T
Gets the visual parent of an IVisual.
static
GetVisualRoot(IVisual) IRenderRoot
Gets the root visual for an IVisual.
static
GetVisualsAt(IVisual, Point) IEnumerable<IVisual>
Enumerates the visible visuals in the visual tree whose bounds contain a point.
static
GetVisualsAt(IVisual, Point, Func<IVisual, bool>) IEnumerable<IVisual>
Enumerates the visuals in the visual tree whose bounds contain a point.
static
IsVisualAncestorOf(IVisual, IVisual) bool
Tests whether an IVisual is an ancestor of another visual.
static
SortByZIndex(IEnumerable<IVisual>) IEnumerable<IVisual>
static