ForEachChild Method

ForEachChild<TElement>(VisualElement, Action<TElement>)

Execute an action on all direct children with a certain type.

Declaration
public static void ForEachChild<TElement>(this VisualElement ve, Action<TElement> action)
    where TElement : VisualElement
Parameters
VisualElement ve

The parent element.

Action<TElement> action

The action to execute.

Type Parameters
TElement

The type of the child elements.

ForEachChild<TElement>(VisualElement.Hierarchy, Action<TElement>)

Execute an action on all direct children with a certain type.

Declaration
public static void ForEachChild<TElement>(this VisualElement.Hierarchy hierarchy, Action<TElement> action)
    where TElement : VisualElement
Parameters
VisualElement.Hierarchy hierarchy

The parent hierarchy.

Action<TElement> action

The action to execute.

Type Parameters
TElement

The type of the child elements.