Click or drag to resize

VisualFindVisualAndAncestorsAspectT Method

Find the first aspect of type T on this visual or one of its ancestors (parents, grand-parents, etc.).

Namespace:  Demo3D.Visuals
Assembly:  Demo3D.Core (in Demo3D.Core.dll) Version: 15.0.2.11458
Syntax
C#
public T FindVisualAndAncestorsAspect<T>()
where T : class

Type Parameters

T
The aspect type to look for.

Return Value

Type: T
The first instance of aspect of type T in the hierarchy of this visual and visual above this visual, or null if not found.
Examples
C#
BBox GetBoundsVisualAndAncestors(Visual visual) {
    // Get the bounding box of the first IRenderable on this visual or its closest ancestor (or null if there isn't one)
    return visual.FindVisualAndAncestorsAspect<IRenderable>()?.BoundingBox;
}
See Also