Class Extensions
public static class Extensions
- Inheritance
-
Extensions
- Inherited Members
Methods
FindLogicalAncestor<T>(DependencyObject)
Finds the first ancestor of a specific type in the logical tree / visual tree.
public static T FindLogicalAncestor<T>(this DependencyObject dependencyObject) where T : class
Parameters
dependencyObject
DependencyObjectThe dependency object to find ancestor for.
Returns
- T
The ancestor, or
null
if no match found.
Type Parameters
T
The type to search for.
Remarks
Uses GetParent(DependencyObject) and GetParent(DependencyObject) internally.
FindLogicalChildren<T>(DependencyObject)
Finds all the children in the logical tree of a specific type from a certain point.
public static IEnumerable<T> FindLogicalChildren<T>(this DependencyObject depObj) where T : DependencyObject
Parameters
depObj
DependencyObjectThe starting point for the search.
Returns
- IEnumerable<T>
All the children found.
Type Parameters
T
The type to search for.
Remarks
Uses LogicalTreeHelper internally.
FindVisualAncestor<T>(DependencyObject)
Finds the first ancestor of a specific type in the visual tree.
public static T FindVisualAncestor<T>(this DependencyObject dependencyObject) where T : class
Parameters
dependencyObject
DependencyObjectThe dependency object to find ancestor for.
Returns
- T
The ancestor, or
null
if no match found.
Type Parameters
T
The type to search for.
Remarks
Uses GetParent(DependencyObject) internally.
FindVisualChildren<T>(DependencyObject)
Finds all the children in the visual tree of a specific type from a certain point.
public static IEnumerable<T> FindVisualChildren<T>(this DependencyObject depObj) where T : DependencyObject
Parameters
depObj
DependencyObjectThe starting point for the search.
Returns
- IEnumerable<T>
All the children found.
Type Parameters
T
The type to search for.
Remarks
Uses VisualTreeHelper internally.
FindVisualTreeRoot(DependencyObject)
Finds the visual root in the visual/logical tree.
public static DependencyObject FindVisualTreeRoot(this DependencyObject initial)
Parameters
initial
DependencyObjectThe stating element.
Returns
- DependencyObject
The root for this branch.
Remarks
Uses GetParent(DependencyObject) and GetParent(DependencyObject) internally.