Compartir a través de


ExtensionMethods.FindCommonAncestor Method

Definition

Overloads

FindCommonAncestor(DependencyObject, DependencyObject)

Finds the common ancestor of obj1 and obj2 using the GetVisualOrLogicalParent as the parent evaluation method.

FindCommonAncestor<T>(T, T, Func<T,T>)

Finds the common ancestor of obj1 and obj2 using the given function to get the parent of each element.

FindCommonAncestor(DependencyObject, DependencyObject)

Finds the common ancestor of obj1 and obj2 using the GetVisualOrLogicalParent as the parent evaluation method.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Windows::DependencyObject ^ FindCommonAncestor(System::Windows::DependencyObject ^ obj1, System::Windows::DependencyObject ^ obj2);
public static System.Windows.DependencyObject FindCommonAncestor (this System.Windows.DependencyObject obj1, System.Windows.DependencyObject obj2);
static member FindCommonAncestor : System.Windows.DependencyObject * System.Windows.DependencyObject -> System.Windows.DependencyObject
<Extension()>
Public Function FindCommonAncestor (obj1 As DependencyObject, obj2 As DependencyObject) As DependencyObject

Parameters

obj1
DependencyObject

The first object.

obj2
DependencyObject

The second object.

Returns

The first element in the parent tree that is both an ancestor of obj1 and obj2, or null if no such element exists.

Applies to

FindCommonAncestor<T>(T, T, Func<T,T>)

Finds the common ancestor of obj1 and obj2 using the given function to get the parent of each element.

public:
generic <typename T>
 where T : System::Windows::DependencyObject[System::Runtime::CompilerServices::Extension]
 static T FindCommonAncestor(T obj1, T obj2, Func<T, T> ^ parentEvaluator);
public static T FindCommonAncestor<T> (this T obj1, T obj2, Func<T,T> parentEvaluator) where T : System.Windows.DependencyObject;
static member FindCommonAncestor : 'T * 'T * Func<'T, 'T (requires 'T :> System.Windows.DependencyObject and 'T :> System.Windows.DependencyObject)> -> 'T (requires 'T :> System.Windows.DependencyObject)
<Extension()>
Public Function FindCommonAncestor(Of T As DependencyObject) (obj1 As T, obj2 As T, parentEvaluator As Func(Of T, T)) As T

Type Parameters

T

Parameters

obj1
T

The first object.

obj2
T

The second object.

parentEvaluator
Func<T,T>

The method used to determine the parent of an element.

Returns

T

The first element in the parent tree that is both an ancestor of obj1 and obj2, or null if no such element exists.

Applies to