TreeHelper.

TryFindParent<T>(DependencyObject) Method

Summary

Finds a parent of a given item on the visual tree.
Namespace
MahApps.Metro.Controls
Containing Type
TreeHelper

Syntax

public static T TryFindParent<T>(this DependencyObject child) where T : DependencyObject

Type Parameters

Name Description
T The type of the queried item.

Parameters

Name Type Description
child DependencyObject A direct or indirect child of the queried item.

Return Value

Type Description
T The first parent item that matches the submitted type parameter. If not matching item can be found, a null reference is being returned.