VisualTreeHelper.GetChild Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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)


Public Shared Function GetChild ( _
    reference As DependencyObject, _
    childIndex As Integer _
) As DependencyObject
public static DependencyObject GetChild(
    DependencyObject reference,
    int childIndex


  • 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.


Exception Condition

Specified an invalid child index.


reference is nulla null reference (Nothing in Visual Basic), or is not a valid UIElement.

Version Information


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.