FrameworkElement.GetVisualChild Method (Int32)
Overrides Visual.GetVisualChild, and returns a child at the specified index from a collection of child elements.
Assembly: PresentationFramework (in PresentationFramework.dll)
The zero-based index of the requested child element in the collection.
Return ValueType: System.Windows.Media.Visual
The requested child element. This should not return null; if the provided index is out of range, an exception is thrown.
In the FrameworkElement implementation, the only valid index is zero. The content model for supports either zero or one child elements, not a collection.
Notes to Inheritors:
This implementation is only valid for elements that do not maintain any more descriptive collection of visual child elements. Any element that does have such a collection must override this method and map the index to an equivalent index in the child element collection that is supported by that element. An index in the range from zero to VisualChildrenCount (minus one) should return a valid element; any other index should throw an out-of-range exception. An example of an element type that does support a child collection and overrides to return more than one possible child is Panel.
The default implementation in FrameworkElement presumes only one visual child. Any value passed for index other than zero causes an exception to be thrown. Several common elements, such as decorators, adorners, or elements with specialized rendering, override the FrameworkElement implementation (of the implementation from intermediate base classes). Some implementations still enforce one visual child whereas others allow a collection.
Available since 3.0