Visual.VisualChildrenCount Visual.VisualChildrenCount Visual.VisualChildrenCount Visual.VisualChildrenCount Property

定義

Visual の子要素の数を取得します。Gets the number of child elements for the Visual.

protected:
 virtual property int VisualChildrenCount { int get(); };
protected virtual int VisualChildrenCount { get; }
member this.VisualChildrenCount : int
Protected Overridable ReadOnly Property VisualChildrenCount As Integer

プロパティ値

子要素の数。The number of child elements.

次の例では、のVisualChildrenCountオーバーライドされた実装を定義します。The following example defines an overridden implementation of VisualChildrenCount.

// Provide a required override for the VisualChildrenCount property.
protected override int VisualChildrenCount
{
    get { return _children.Count; }
}
' Provide a required override for the VisualChildrenCount property.
Protected Overrides ReadOnly Property VisualChildrenCount() As Integer
    Get
        Return _children.Count
    End Get
End Property

注釈

既定では、 Visualには子がありません。By default, a Visual has no children. したがって、既定の実装では常に0が返されます。Therefore, the default implementation always returns 0.

注意 (継承者)

からVisual派生するクラスは、ビジュアルツリーを正しく列挙するためGetVisualChild(Int32)に、このプロパティとメソッドもオーバーライドする必要があります。A class that derives from Visual must override this property, and also the GetVisualChild(Int32) method, for the visual tree to be enumerated correctly.

適用対象