public abstract class Sandbox.UI.BaseVirtualPanel : Sandbox.UI.Panel
Base class for virtualized, scrollable panels that only create item panels when visible.
Constructors
Showing 1 constructors
protected BaseVirtualPanel()
Initializes the base virtual panel with default styles.
No results match this filter.
Methods
Showing 15 methods
public void AddItem(object item)
Adds a single item and marks the panel for rebuild.
Parameters
item: The item to append.
public void AddItems(System.Collections.Generic.IEnumerable`1<object> items)
public void Clear()
Clears all items and destroys created panels.
protected virtual void FinalLayoutChildren(Vector2 offset)
Final layout pass for child panels and scroll bounds.
Parameters
offset: Layout offset.
protected virtual float GetTotalHeight(int itemCount)
Gets the total height needed to display the specified number of items.
Parameters
itemCount: Number of items.
Returns
Total height in layout units.
protected virtual void GetVisibleRange(int first, int pastEnd)
Gets the range of visible item indices.
Parameters
first: First visible index (inclusive).pastEnd: Past-the-end index (exclusive).
public bool HasData(int i)
Returns true if `i` is a valid item index.
Parameters
i: Item index.
Returns
True if within bounds; otherwise false.
public void InsertItem(int index, object item)
Inserts an item at the specified index and marks the panel for rebuild.
Parameters
index: The zero-based index at which item should be inserted.item: The item to insert.
protected virtual void PositionPanel(int index, Sandbox.UI.Panel panel)
Positions a panel at the specified index.
Parameters
index: Item index.panel: Panel to position.
public void RemoveAt(int index)
Removes the item at the specified index and marks the panel for rebuild.
Parameters
index: The zero-based index of the item to remove.
public bool RemoveItem(object item)
Removes the first occurrence of a specific item and marks the panel for rebuild.
Parameters
item: The item to remove.
Returns
True if item was found and removed; otherwise false.
public void SetItems(System.Collections.Generic.IEnumerable`1<object> enumerable)
public virtual void Tick()
Per-frame update: adjusts spacing from CSS, updates layout, creates/destroys visible panels.
protected virtual bool UpdateLayout()
Updates the layout and returns true if the layout changed.
Returns
True if layout was updated; otherwise false.
protected virtual void UpdateLayoutSpacing(Vector2 spacing)
Updates the layout spacing based on CSS gaps.
Parameters
spacing: The spacing vector from CSS.
No results match this filter.
Properties
Showing 6 properties
public Microsoft.AspNetCore.Components.RenderFragment`1<object> Sandbox.UI.BaseVirtualPanel.Item { get; set; }
Template used to render an item into a cell panel.
public int Sandbox.UI.BaseVirtualPanel.ItemCount { get; set; }
Gets the number of items in the panel.
public System.Collections.Generic.IEnumerable`1<object> Sandbox.UI.BaseVirtualPanel.Items { get; set; }
Replaces the current items. Only triggers a rebuild if the sequence is actually different. When set to an IList (like List), changes to the source list will be automatically detected.
public bool Sandbox.UI.BaseVirtualPanel.NeedsRebuild { get; set; }
When true, forces a layout rebuild on the next `Sandbox.UI.BaseVirtualPanel.Tick`.
public System.Action`2<Sandbox.UI.Panel,object> Sandbox.UI.BaseVirtualPanel.OnCreateCell { get; set; }
Called when a cell is created. Allows you to fill the cell in
public System.Action Sandbox.UI.BaseVirtualPanel.OnLastCell { get; set; }
Called when the last cell has been viewed. This allows you to view more.
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox.UI |
| Type | class |
| Assembly | Sandbox.Engine |
| Doc ID | T:Sandbox.UI.BaseVirtualPanel |