Visual.GetVisualChild(Int32) Yöntem

Tanım

Üst Visualöğesinde belirtilen VisualCollection değerini döndürür.

protected:
 virtual System::Windows::Media::Visual ^ GetVisualChild(int index);
protected virtual System.Windows.Media.Visual GetVisualChild(int index);
abstract member GetVisualChild : int -> System.Windows.Media.Visual
override this.GetVisualChild : int -> System.Windows.Media.Visual
Protected Overridable Function GetVisualChild (index As Integer) As Visual

Parametreler

index
Int32

içindeki görsel nesnesinin VisualCollectiondizini.

Döndürülenler

belirtilen VisualCollection değerdeki öğesindeki index alt öğe.

Örnekler

Aşağıdaki örnek geçersiz kılınan GetVisualChilduygulamasını tanımlar.

// 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];
}
' Provide a required override for the GetVisualChild method.
Protected Overrides Function GetVisualChild(ByVal index As Integer) As Visual
    If index < 0 OrElse index >= _children.Count Then
        Throw New ArgumentOutOfRangeException()
    End If

    Return _children(index)
End Function

Açıklamalar

Varsayılan olarak, alt Visual öğe yoktur. Bu nedenle, varsayılan uygulama her zaman bir ArgumentOutOfRangeExceptionoluşturur.

Devralanlara Notlar

öğesinden Visual türetilen bir sınıf, görsel ağacının VisualChildrenCount doğru numaralandırılabilmesi için bu yöntemi ve özelliğini geçersiz kılmalıdır.

Şunlara uygulanır