Version

GetParent(DependencyObject,Boolean) Method

Returns the parent of a child element.
Syntax
'Declaration
 
Public Overloads Shared Function GetParent( _
   ByVal child As DependencyObject, _
   ByVal includeLogicalParent As Boolean _
) As DependencyObject
public static DependencyObject GetParent( 
   DependencyObject child,
   bool includeLogicalParent
)

Parameters

child
The child element.
includeLogicalParent
Whether to consider logical parent as well. If the visual parent is null and this parameter is true then the logical parent of the child will be returned.

Return Value

The parent element.
Remarks

Note: if the child derives from System.Windows.Media.Visual or System.Windows.Media.Media3D.Visual3D this method returns its visual parent. If the visual parent is null and includeLogicalParent parameter is true then it returns the logical parent of the child if any. If the child is derived from System.Windows.FrameworkContentElement this method returns its logical parent unless includeLogicalParent parameter is false.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also