The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

FrameworkElement.Parent Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets the parent object of this FrameworkElement in the object tree.

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

public DependencyObject Parent { get; }

Property Value

Type: System.Windows.DependencyObject
The parent object of this object in the object tree.

Parent may be null in cases where an object was instantiated, but is not attached to an object that eventually connects to the Windows Phone RootVisual, or the application object.

In the core Windows Phone classes, the parent of a FrameworkElement can also be expected to be a FrameworkElement as long as it is not returned as null. But custom classes might introduce a content model where this assumption is not true.

Note that the parent of an object can potentially change depending on your application's functionality, and keeping the value of this property as an instance will not reflect that change. You typically should get the parent object value immediately before you need it for other operations, and should not rely on the value past this point.

Note that this property is read-only. Changing the parent of an object can be accomplished, but is only done through manipulation of collections. For example, you can change a parent relationship by using dedicated add or remove methods, or through setting container properties of objects such as Children on a Panel.

Windows Phone Tree Concepts

The value reported by the FrameworkElement.Parent property in Windows Phone is generally the same value that would be reported by using VisualTreeHelper API, because the two tree concepts are frequently synchronized as far as how parent-child relationships are reported. However, there may be cases where FrameworkElement.Parent reports a parent that VisualTreeHelper does not.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone