VisualTreeHelper.GetChildrenCount Method

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

Returns the number of children that exists in an object's child collection in the visual tree.

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

Syntax

Public Shared Function GetChildrenCount ( _
    reference As DependencyObject _
) As Integer
public static int GetChildrenCount(
    DependencyObject reference
)

Parameters

Return Value

Type: System..::.Int32
The number of visual children for the provided source visual.

Exceptions

Exception Condition
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

See Also

Reference

VisualTreeHelper Class

System.Windows.Media Namespace