ContentOperations.GetParent Method (ContentElement)

 

Gets the parent element of the specified ContentElement.

Namespace:   System.Windows
Assembly:  PresentationCore (in PresentationCore.dll)

public static DependencyObject GetParent(
	ContentElement reference
)

Parameters

reference
Type: System.Windows.ContentElement

The ContentElement to get the parent from.

Return Value

Type: System.Windows.DependencyObject

The parent element in the current tree.

Most practical ContentElement derived classes in WPF are also a FrameworkContentElement derived class. For these classes, the Parent property should be used instead.

Parent returns the parent element in the logical tree, which might not be the same element as returned by GetParentGetParent exists specifically to correct for certain architectural issues whereby a ContentElement class that is not also a FrameworkContentElement exists in a tree that is not strictly speaking either the logical tree or the visual tree.

.NET Framework
Available since 3.0
Return to top
Show: