Skip to content

UIGrid Class

Definition

Namespace: Brine2D.UI

A container that arranges its children in a fixed-column grid, flowing left-to-right and top-to-bottom. Each cell is sized to the largest child currently in the grid. Brine2D.UI.UIGrid.Size is updated to fit all rows and columns on every Brine2D.UI.UIGrid.Render\(Brine2D\.Rendering\.IRenderer\) call.

C#
public class UIGrid : Brine2D.UI.IUIComponent, Brine2D.UI.IAnchoredUIComponent

Inheritance System.Object → UIGrid

Implements IUIComponent, IAnchoredUIComponent

Properties
Anchor The screen anchor point this component is positioned relative to.
AnchorOffset Pixel offset from the resolved anchor point.
BackgroundColor Optional background color. When null, no background is drawn.
BlocksInput When true, mouse events over this grid are consumed. Defaults to false.
ClipChildren When true, children are clipped to the grid bounds during rendering. Defaults to false.
Columns Number of columns. Defaults to 2.
HorizontalSpacing Horizontal gap between cells in pixels.
LastKnownScreenSize Last screen size pushed by UICanvas. Used when propagating to children added after this grid is already on a canvas.
Padding Padding in pixels on all sides inside the grid background.
VerticalSpacing Vertical gap between rows in pixels.
Methods
AddChild\(IUIComponent\) Adds a child. Children are laid out in the order they are added.
ClearChildren() Removes all children.
GetChildren() Gets all children in layout order.
PerformLayout() Recomputes each child's position from Columns, spacing, and padding. Cell dimensions come from the widest/tallest visible child. Returns the total content size including padding. Can be called before the first Brine2D.UI.UIGrid.Render\(Brine2D\.Rendering\.IRenderer\) if you need sizes early.
RemoveChild\(IUIComponent\) Removes a child.