Export (0) Print
Expand All

Visual.GetVisualChild Method

Returns the specified Visual in the parent VisualCollection.

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

protected virtual Visual GetVisualChild (
	int index
)
protected Visual GetVisualChild (
	int index
)
protected function GetVisualChild (
	index : int
) : Visual
You cannot use methods in XAML.

Parameters

index

The index of the visual object in the VisualCollection.

Return Value

The child in the VisualCollection at the specified index value.

A class that derives from Visual must override this method, and also the VisualChildrenCount property, for the visual tree to be enumerated correctly.

The following example defines an overridden implementation of GetVisualChild.

// Provide a required override for the GetVisualChild method.
protected override Visual GetVisualChild(int index)
{
    if (index < 0 || index > _children.Count)
    {
        throw new ArgumentOutOfRangeException();
    }

    return _children[index];
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft