Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets the parent object of the calling object.
retval = object.GetParent()
A reference to the parent object if successful; otherwise, returns null.
The only objects that can contain UIElement children are Canvas and InkPresenter. The UIElement types that can be child objects of Canvas and InkPresenter are listed in the "Applies To" section of this topic.
Calling the GetParent method on Canvas or on any other object that is at the XAML root will return null. To retrieve the hosting plug-in instance, always use the GetHost method.
Path can have child elements, but these are geometries instead of UIElement objects. Therefore, you cannot call GetParent on a Path's child elements. As a workaround, you should always name the Path so that it can be accessed without having to walk the tree.
Border (Silverlight 2)
PasswordBox (Silverlight 2)
Popup (Silverlight 2)
StackPanel (Silverlight 2)
TextBox (Silverlight 2)