Table of Contents

Class Grid

Namespace
BSGameLib.UI.Controls
Assembly
BSGameLib.UI.dll

A layout that places its children in a fixed grid of rows and columns.

public class Grid : LayoutControl, IUpdateable, IEquatable<IUpdateable>, IDrawable, IIdentifiable<Guid>, IEquatable<IDrawable>, IDisposable
Inheritance
Grid
Implements
Inherited Members

Constructors

Grid(ILogger, View, int, int, string)

Creates a grid of rows rows and columns columns. Each is at least 1.

public Grid(ILogger logger, View view, int rows, int columns, string id = null)

Parameters

logger ILogger
view View
rows int
columns int
id string

Properties

CellHeight

The height of each cell, in pixels. A child taller than its cell overflows it.

public float CellHeight { get; set; }

Property Value

float

CellWidth

The width of each cell, in pixels. A child wider than its cell overflows it.

public float CellWidth { get; set; }

Property Value

float

ColumnSpacing

The gap between columns, in pixels.

public float ColumnSpacing { get; set; }

Property Value

float

Columns

The number of columns. At least 1; set by the constructor.

public int Columns { get; }

Property Value

int

HorizontalAlignment

Where each child sits across its cell.

public HorizontalAlignment HorizontalAlignment { get; set; }

Property Value

HorizontalAlignment

Padding

The space kept clear inside each cell on the side a child is aligned to.

public Spacing Padding { get; set; }

Property Value

Spacing

RowSpacing

The gap between rows, in pixels.

public float RowSpacing { get; set; }

Property Value

float

Rows

The number of rows. At least 1; set by the constructor.

public int Rows { get; }

Property Value

int

VerticalAlignment

Where each child sits down its cell.

public VerticalAlignment VerticalAlignment { get; set; }

Property Value

VerticalAlignment

Methods

ArrangeControls()

Positions each visible child in its cell, aligned as the grid's alignment says.

protected override void ArrangeControls()

GetPlacement(UIElement)

Returns where element is placed. An element never placed is at row 0, column 0, spanning one cell.

public GridPlacement GetPlacement(UIElement element)

Parameters

element UIElement

Returns

GridPlacement

SetPlacement(UIElement, int, int, int, int)

Places element in the cell at row and column, spanning the given numbers of rows and columns.

public void SetPlacement(UIElement element, int row, int column, int rowSpan = 1, int columnSpan = 1)

Parameters

element UIElement
row int
column int
rowSpan int
columnSpan int

Exceptions

ArgumentOutOfRangeException

row or column is outside the grid.