Class ViewCollection
A base class for container views that hold and manage a list of child views. Provides methods for adding, removing, rendering, and hit testing children.
public abstract class ViewCollection : View- Inheritance
- 
      
      
      ViewCollection
- Derived
- Inherited Members
Fields
children
The internal list of child views contained within this view.
protected readonly List<View> childrenField Value
Properties
Content
Adds the provided views to this container during object initialization. This property is intended for use with C# object initializers and will not clear existing children.
public ReadOnlySpan<View> Content { init; }Property Value
Count
Gets the number of child views in this collection.
public override int Count { get; }Property Value
this[int]
Gets the child view at the specified index.
public override View this[int index] { get; }Parameters
- indexint
- The index of the child to retrieve. 
Property Value
- View
- The child view at the given index. 
Methods
Add(View)
Adds a view to this container.
public virtual void Add(View child)Parameters
- childView
- The view to add. 
Exceptions
- InvalidOperationException
- Thrown if the view already has a parent. 
HitTest(Point)
Performs hit testing against the child views in reverse order (top-most first).
public override bool HitTest(Point point)Parameters
- pointPoint
- The point to test, in the coordinate space of this view. 
Returns
- bool
- True if any child was hit; otherwise, falls back to base implementation. 
Remove(View)
Removes a view from this container.
public virtual void Remove(View child)Parameters
- childView
- The view to remove. 
RenderCore(IContext)
Renders all child views using the provided rendering context.
protected override void RenderCore(IContext context)Parameters
- contextIContext
- The rendering context used for drawing visual content.