VisualTreeHelper.GetParent Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Returns an object's parent object in the visual tree.
Assembly: System.Windows (in System.Windows.dll)
'Declaration Public Shared Function GetParent ( _ reference As DependencyObject _ ) As DependencyObject
Parameters
- reference
- Type: System.Windows.DependencyObject
The object to get the parent object for.
Return Value
Type: System.Windows.DependencyObjectThe parent object of the reference object in the visual tree.
| Exception | Condition |
|---|---|
| InvalidOperationException | reference is Nothing, or is not a valid UIElement. |
Show: