# Sandbox.UI.BaseVirtualPanel

Base class for virtualized, scrollable panels that only create item panels when visible.

- Kind: class
- Namespace: `Sandbox.UI`
- Assembly: `Sandbox.Engine`
- Inherits: [Sandbox.UI.Panel](/api/Sandbox.UI.Panel)
- Modifiers: abstract

## Properties

- [`Item`](/api/Sandbox.UI.BaseVirtualPanel/Item): Template used to render an item into a cell panel.
- [`ItemCount`](/api/Sandbox.UI.BaseVirtualPanel/ItemCount): Gets the number of items in the panel.
- [`Items`](/api/Sandbox.UI.BaseVirtualPanel/Items): Replaces the current items. Only triggers a rebuild if the sequence is actually different. When set to an IList (like List<T>), changes to the source list will be automatically detected.
- [`NeedsRebuild`](/api/Sandbox.UI.BaseVirtualPanel/NeedsRebuild): When true, forces a layout rebuild on the next [Sandbox.UI.BaseVirtualPanel.Tick](/api/Sandbox.UI.BaseVirtualPanel/Tick).
- [`OnCreateCell`](/api/Sandbox.UI.BaseVirtualPanel/OnCreateCell): Called when a cell is created. Allows you to fill the cell in
- [`OnLastCell`](/api/Sandbox.UI.BaseVirtualPanel/OnLastCell): Called when the last cell has been viewed. This allows you to view more.

## Methods

- [`AddItem`](/api/Sandbox.UI.BaseVirtualPanel/AddItem): Adds a single item and marks the panel for rebuild.
- [`AddItems`](/api/Sandbox.UI.BaseVirtualPanel/AddItems)
- [`Clear`](/api/Sandbox.UI.BaseVirtualPanel/Clear): Clears all items and destroys created panels.
- [`HasData`](/api/Sandbox.UI.BaseVirtualPanel/HasData): Returns true if `i` is a valid item index.
- [`InsertItem`](/api/Sandbox.UI.BaseVirtualPanel/InsertItem): Inserts an item at the specified index and marks the panel for rebuild.
- [`RemoveAt`](/api/Sandbox.UI.BaseVirtualPanel/RemoveAt): Removes the item at the specified index and marks the panel for rebuild.
- [`RemoveItem`](/api/Sandbox.UI.BaseVirtualPanel/RemoveItem): Removes the first occurrence of a specific item and marks the panel for rebuild.
- [`SetItems`](/api/Sandbox.UI.BaseVirtualPanel/SetItems)
- [`Tick`](/api/Sandbox.UI.BaseVirtualPanel/Tick): Per-frame update: adjusts spacing from CSS, updates layout, creates/destroys visible panels.
