ClassParentOfTypeExtensions
Contains extension methods for enumerating the parents of an element.
Definition
Namespace:Telerik.Windows.Controls
Assembly:Telerik.Windows.Controls.dll
Syntax:
public static class ParentOfTypeExtensions
Inheritance: objectParentOfTypeExtensions
Methods
GetParents(DependencyObject)
Enumerates through element's parents in the visual tree.
Declaration
public static IEnumerable<DependencyObject> GetParents(this DependencyObject element)
Parameters
element
DependencyObject
Returns
IEnumerable<DependencyObject>
GetVisualParent<T>(DependencyObject)
Searches up in the visual tree for parent element of the specified type.
Declaration
[SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
public static T GetVisualParent<T>(this DependencyObject element) where T : DependencyObject
Parameters
element
DependencyObject
The target DependencyObject which visual parents will be traversed.
Returns
T
Visual parent of the specified type if there is any, otherwise null.
IsAncestorOf(DependencyObject, DependencyObject)
Determines whether the element is an ancestor of the descendant.
Declaration
public static bool IsAncestorOf(this DependencyObject element, DependencyObject descendant)
Parameters
element
DependencyObject
descendant
DependencyObject
Returns
true if the visual object is an ancestor of descendant; otherwise, false.
ParentOfType<T>(DependencyObject)
Gets the parent element from the visual tree by given type.
Declaration
public static T ParentOfType<T>(this DependencyObject element) where T : DependencyObject
Parameters
element
DependencyObject
Returns
T