Class VisualTreeHelper
public static class VisualTreeHelper
- Inheritance
-
VisualTreeHelper
Methods
FindVisualChildOfType<T>(UIElement, string)
Find the first child that match the given type, along the visual tree.
public static T FindVisualChildOfType<T>(this UIElement source, string name = null) where T : UIElement
Parameters
source
UIElementBase node from where to start looking for child.
name
string(Optional) name of the element
Returns
- T
Returns the retrieved child, or null otherwise.
Type Parameters
T
Type of child to find.
FindVisualChildrenOfType<T>(UIElement)
Find all the children that match the given type, along the visual tree.
public static IEnumerable<T> FindVisualChildrenOfType<T>(this UIElement source) where T : UIElement
Parameters
source
UIElementBase node from where to start looking for children.
Returns
- IEnumerable<T>
Returns the retrieved children, or empty otherwise.
Type Parameters
T
Type of child to find.
FindVisualParentOfType<T>(UIElement)
Find the first parent that match the given type, along the visual tree.
public static T FindVisualParentOfType<T>(this UIElement source) where T : UIElement
Parameters
source
UIElementBase node from where to start looking for parent.
Returns
- T
Returns the retrieved parent, or null otherwise.
Type Parameters
T
Type of parent to find.
FindVisualRoot(UIElement)
Find the root parent, along the visual tree.
public static UIElement FindVisualRoot(this UIElement source)
Parameters
source
UIElementBase node from where to start looking for root.
Returns
- UIElement
Returns the retrieved root, or null otherwise.