ContainerVisual.VisualChildrenCount Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets the number of children for the ContainerVisual.

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

override VisualChildrenCount : int with get

Property Value

Type: System.Int32

The number of children in the VisualCollection of the ContainerVisual.

By default, a ContainerVisual does not have any children.

Notes to Inheritors:

Classes that derive from ContainerVisual must implement the VisualChildrenCount property to enumerate the visual children. The derived property must return the number of children for the ContainerVisual.

The visual tree cannot be modified during this call.

The following example shows how to create a ContainerVisual object that is used as the parent for two DrawingVisual objects. Objects that are added to the ContainerVisual object must be added in reverse z-order (bottom to top) to ensure they are rendering in the correct drawing order. In order for the visual tree to be enumerated correctly, the example provides overridden implementations of the GetVisualChild method and VisualChildrenCount property.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0
Return to top