VisualTreeHelper.GetChild Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Using the provided index, obtains a specific child object of the provided object by examining the visual tree.
Namespace: System.Windows.Media
Assembly: System.Windows (in System.Windows.dll)
Syntax
Public Shared Function GetChild ( _
reference As DependencyObject, _
childIndex As Integer _
) As DependencyObject
public static DependencyObject GetChild(
DependencyObject reference,
int childIndex
)
Parameters
- reference
Type: System.Windows..::.DependencyObject
The object that holds the child collection.
- childIndex
Type: System..::.Int32
The index of the requested child object in the reference child collection.
Return Value
Type: System.Windows..::.DependencyObject
The child object as referenced by childIndex.
Exceptions
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | Specified an invalid child index. |
| InvalidOperationException | reference is nullNothingnullptra null reference (Nothing in Visual Basic), or is not a valid UIElement. |
Version Information
Windows Phone OS
Supported in: 8.1, 8.0, 7.1, 7.0
Platforms
Windows Phone