共用方式為


Visual.VisualChildrenCount 屬性

定義

取得 Visual 的子項目數量。

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

屬性值

Int32

子項目數量。

範例

下列範例會定義 覆寫的 實作 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 子系。 因此,預設實作一律會傳回 0。

給繼承者的注意事項

衍生自 Visual 的類別必須覆寫此屬性,以及 GetVisualChild(Int32) 方法,才能正確列舉視覺化樹狀結構。

適用於