Api Sandbox UI BaseVirtualPanel
class

BaseVirtualPanel

public abstract class BaseVirtualPanel : Panel

Base class for virtualized, scrollable panels that only create item panels when visible.

Properties

Name Type Description
NeedsRebuild Boolean When true, forces a layout rebuild on the next Tick.
Item RenderFragment<Object> Template used to render an item into a cell panel.
OnCreateCell Action<Panel, Object> Called when a cell is created. Allows you to fill the cell in
OnLastCell Action Called when the last cell has been viewed. This allows you to view more.
Items IEnumerable<Object> Replaces the current items. Only triggers a rebuild if the sequence is actually different. When set to an IList (like List&lt;T&gt;), changes to the source list will be automatically detected.
ItemCount Int32 Gets the number of items in the panel.

Methods

Void AddItem(Object item)

Adds a single item and marks the panel for rebuild.

item — The item to append.
Void AddItems(IEnumerable<Object> items)
Boolean RemoveItem(Object item)

Removes the first occurrence of a specific item and marks the panel for rebuild.

item — The item to remove.
returns — True if item was found and removed; otherwise false.
Void RemoveAt(Int32 index)

Removes the item at the specified index and marks the panel for rebuild.

index — The zero-based index of the item to remove.
Void InsertItem(Int32 index, Object item)

Inserts an item at the specified index and marks the panel for rebuild.

index — The zero-based index at which item should be inserted.
item — The item to insert.
Void Clear()

Clears all items and destroys created panels.

virtual Void Tick()

Per-frame update: adjusts spacing from CSS, updates layout, creates/destroys visible panels.

Boolean HasData(Int32 i)

Returns true if is a valid item index.

i — Item index.
returns — True if within bounds; otherwise false.
Void SetItems(IEnumerable<Object> enumerable)
Assembly: Sandbox.Engine Namespace: Sandbox.UI Full Name: Sandbox.UI.BaseVirtualPanel