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) 方法,以便正确枚举可视化树。

适用于