Table of Contents

Class ViewCollection

Namespace
Xui.Core.UI
Assembly
Xui.Core.dll

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 class ViewCollection : View, ILayerHost, IServiceProvider
Inheritance
ViewCollection
Implements
Derived
Inherited Members
Extension Methods

Fields

children

The internal list of child views contained within this view.

protected readonly List<View> children

Field Value

List<View>

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

ReadOnlySpan<View>

Count

Gets the number of child views in this collection.

public override int Count { get; }

Property Value

int

this[int]

Gets the child view at the specified index.

public override View this[int index] { get; }

Parameters

index int

Property Value

View

Methods

Add(View)

Adds a view to this container.

public virtual void Add(View child)

Parameters

child View

Exceptions

InvalidOperationException

Thrown if the view already has a parent.

Clear()

Removes all child views from this container.

public virtual void Clear()

Remove(View)

Removes a view from this container.

public virtual void Remove(View child)

Parameters

child View