FrameworkElementExtensions.FindParentOrSelf Method

Definition

Overloads

FindParentOrSelf(FrameworkElement, Type)

Find the first parent (or self) element of a given type.

FindParentOrSelf(FrameworkElement, String, StringComparison)

Find the first parent (or self) of type Windows.UI.Xaml.FrameworkElement with a given name.

FindParentOrSelf<T,TState>(FrameworkElement, TState, Func<T,TState,Boolean>)

Find the first parent (or self) element matching a given predicate.

FindParentOrSelf<T>(FrameworkElement)

Find the first parent (or self) element of a given type.

FindParentOrSelf<T>(FrameworkElement, Func<T,Boolean>)

Find the first parent (or self) element matching a given predicate.

FindParentOrSelf(FrameworkElement, Type)

Find the first parent (or self) element of a given type.

public static Windows.UI.Xaml.FrameworkElement? FindParentOrSelf (this Windows.UI.Xaml.FrameworkElement element, Type type);
static member FindParentOrSelf : Windows.UI.Xaml.FrameworkElement * Type -> Windows.UI.Xaml.FrameworkElement
<Extension()>
Public Function FindParentOrSelf (element As FrameworkElement, type As Type) As FrameworkElement

Parameters

element
Windows.UI.Xaml.FrameworkElement

The starting element.

type
Type

The type of element to match.

Returns

Windows.UI.Xaml.FrameworkElement

The parent (or self) that was found, or null.

Applies to

FindParentOrSelf(FrameworkElement, String, StringComparison)

Find the first parent (or self) of type Windows.UI.Xaml.FrameworkElement with a given name.

public static Windows.UI.Xaml.FrameworkElement? FindParentOrSelf (this Windows.UI.Xaml.FrameworkElement element, string name, StringComparison comparisonType = System.StringComparison.Ordinal);
static member FindParentOrSelf : Windows.UI.Xaml.FrameworkElement * string * StringComparison -> Windows.UI.Xaml.FrameworkElement
<Extension()>
Public Function FindParentOrSelf (element As FrameworkElement, name As String, Optional comparisonType As StringComparison = System.StringComparison.Ordinal) As FrameworkElement

Parameters

element
Windows.UI.Xaml.FrameworkElement

The starting element.

name
String

The name of the element to look for.

comparisonType
StringComparison

The comparison type to use to match name.

Returns

Windows.UI.Xaml.FrameworkElement

The parent (or self) that was found, or null.

Applies to

FindParentOrSelf<T,TState>(FrameworkElement, TState, Func<T,TState,Boolean>)

Find the first parent (or self) element matching a given predicate.

public static T? FindParentOrSelf<T,TState> (this Windows.UI.Xaml.FrameworkElement element, TState state, Func<T,TState,bool> predicate) where T : Windows.UI.Xaml.FrameworkElement;
static member FindParentOrSelf : Windows.UI.Xaml.FrameworkElement * 'State * Func<'T, 'State, bool (requires 'T :> Windows.UI.Xaml.FrameworkElement)> -> 'T (requires 'T :> Windows.UI.Xaml.FrameworkElement)
<Extension()>
Public Function FindParentOrSelf(Of T As FrameworkElement, TState As FrameworkElement) (element As FrameworkElement, state As TState, predicate As Func(Of T, TState, Boolean)) As T

Type Parameters

T

The type of elements to match.

TState

The type of state to use when matching nodes.

Parameters

element
Windows.UI.Xaml.FrameworkElement

The starting element.

state
TState

The state to give as input to predicate.

predicate
Func<T,TState,Boolean>

The predicatee to use to match the parent nodes.

Returns

T

The parent (or self) that was found, or null.

Applies to

FindParentOrSelf<T>(FrameworkElement)

Find the first parent (or self) element of a given type.

public static T? FindParentOrSelf<T> (this Windows.UI.Xaml.FrameworkElement element) where T : Windows.UI.Xaml.FrameworkElement;
static member FindParentOrSelf : Windows.UI.Xaml.FrameworkElement -> 'T (requires 'T :> Windows.UI.Xaml.FrameworkElement)
<Extension()>
Public Function FindParentOrSelf(Of T As FrameworkElement) (element As FrameworkElement) As T

Type Parameters

T

The type of elements to match.

Parameters

element
Windows.UI.Xaml.FrameworkElement

The starting element.

Returns

T

The parent (or self) that was found, or null.

Applies to

FindParentOrSelf<T>(FrameworkElement, Func<T,Boolean>)

Find the first parent (or self) element matching a given predicate.

public static T? FindParentOrSelf<T> (this Windows.UI.Xaml.FrameworkElement element, Func<T,bool> predicate) where T : Windows.UI.Xaml.FrameworkElement;
static member FindParentOrSelf : Windows.UI.Xaml.FrameworkElement * Func<'T, bool (requires 'T :> Windows.UI.Xaml.FrameworkElement)> -> 'T (requires 'T :> Windows.UI.Xaml.FrameworkElement)
<Extension()>
Public Function FindParentOrSelf(Of T As FrameworkElement) (element As FrameworkElement, predicate As Func(Of T, Boolean)) As T

Type Parameters

T

The type of elements to match.

Parameters

element
Windows.UI.Xaml.FrameworkElement

The starting element.

predicate
Func<T,Boolean>

The predicatee to use to match the parent nodes.

Returns

T

The parent (or self) that was found, or null.

Applies to