Click or drag to resize

ExtensionsFindVisualParentT Method (DependencyObject)

Returns the parent object of the specified object by processing the visual tree. The difference to FindVisualParent(DependencyObject, Type) is that this also consider sub-classes.

Namespace:  Cauldron.XAML
Assembly:  Cauldron.Win32.WPF (in Cauldron.Win32.WPF.dll) Version: 3.2.0.1 (3.2.0.1)
Syntax
C#
public static T FindVisualParent<T>(
	this DependencyObject element
)
where T : DependencyObject

Parameters

element
Type: System.WindowsDependencyObject
The object to find the parent object for. This is expected to be either a FrameworkElement or a FrameworkContentElement.

Type Parameters

T
The type of the parent to find

Return Value

Type: T
The requested parent object.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DependencyObject. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also