ExtensionMethods.FindAncestor ExtensionMethods.FindAncestor ExtensionMethods.FindAncestor ExtensionMethods.FindAncestor Method

Definition

Overloads

FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>)

Microsoft internal use only.

FindAncestor<TAncestorType>(Visual) FindAncestor<TAncestorType>(Visual) FindAncestor<TAncestorType>(Visual) FindAncestor<TAncestorType>(Visual)

Finds the first ancestor of a given type in the logical or visual tree.

FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>)

FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>)

Microsoft internal use only.

public:
generic <typename TAncestorType, typename TElementType>
 where TAncestorType : class[System::Runtime::CompilerServices::Extension]
 static TAncestorType FindAncestor(TElementType obj, Func<TElementType, TElementType> ^ parentEvaluator);
public static TAncestorType FindAncestor<TAncestorType,TElementType> (this TElementType obj, Func<TElementType,TElementType> parentEvaluator) where TAncestorType : class;
static member FindAncestor : 'ElementType * Func<'ElementType, 'ElementType> -> 'AncestorType (requires 'AncestorType : null)
<Extension()>
Public Function FindAncestor(Of TAncestorType As Class, TElementType As Class) (obj As TElementType, parentEvaluator As Func(Of TElementType, TElementType)) As TAncestorType
Type Parameters
TAncestorType

The type of ancestor to find.

TElementType

The base type of intermediate elements in the ancestor tree.

Parameters
obj

The object at which to begin searching.

parentEvaluator
Func<TElementType,TElementType>

The method used to determine the parent of an element.

Returns
TAncestorType TAncestorType TAncestorType TAncestorType

FindAncestor<TAncestorType>(Visual) FindAncestor<TAncestorType>(Visual) FindAncestor<TAncestorType>(Visual) FindAncestor<TAncestorType>(Visual)

Finds the first ancestor of a given type in the logical or visual tree.

public:
generic <typename TAncestorType>
 where TAncestorType : System::Windows::DependencyObject[System::Runtime::CompilerServices::Extension]
 static TAncestorType FindAncestor(System::Windows::Media::Visual ^ obj);
public static TAncestorType FindAncestor<TAncestorType> (this System.Windows.Media.Visual obj) where TAncestorType : System.Windows.DependencyObject;
static member FindAncestor : System.Windows.Media.Visual -> 'AncestorType (requires 'AncestorType :> System.Windows.DependencyObject)
<Extension()>
Public Function FindAncestor(Of TAncestorType As DependencyObject) (obj As Visual) As TAncestorType
Type Parameters
TAncestorType

The type of ancestor to find.

Parameters
obj
Visual Visual Visual Visual

The object at which to begin searching.

Returns
TAncestorType TAncestorType TAncestorType TAncestorType

The first ancestor of type T in the parent chain of obj, or null if no ancestor is found

Remarks

The type of obj is the Visual rather than the DependencyObject in order to disambiguate this method from FindAncestor(ViewElement element). If you need to find an ancestor of a non-Visual DependencyObject you should call FindAncestor<TAncestorType, DependencyObject>(obj, GetVisualOrLogicalParent) directly.

FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>)

public:
generic <typename TElementType>
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ FindAncestor(TElementType obj, Func<TElementType, TElementType> ^ parentEvaluator, Func<TElementType, bool> ^ ancestorSelector);
public static object FindAncestor<TElementType> (this TElementType obj, Func<TElementType,TElementType> parentEvaluator, Func<TElementType,bool> ancestorSelector);
static member FindAncestor : 'ElementType * Func<'ElementType, 'ElementType> * Func<'ElementType, bool> -> obj
<Extension()>
Public Function FindAncestor(Of TElementType) (obj As TElementType, parentEvaluator As Func(Of TElementType, TElementType), ancestorSelector As Func(Of TElementType, Boolean)) As Object
Type Parameters
TElementType
Parameters
obj
parentEvaluator
Func<TElementType,TElementType>
ancestorSelector
Func<TElementType,Boolean>
Returns

Applies to