Class Grid
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
Properties
CellHeight
The height of each cell, in pixels. A child taller than its cell overflows it.
public float CellHeight { get; set; }
Property Value
CellWidth
The width of each cell, in pixels. A child wider than its cell overflows it.
public float CellWidth { get; set; }
Property Value
ColumnSpacing
The gap between columns, in pixels.
public float ColumnSpacing { get; set; }
Property Value
Columns
The number of columns. At least 1; set by the constructor.
public int Columns { get; }
Property Value
HorizontalAlignment
Where each child sits across its cell.
public HorizontalAlignment HorizontalAlignment { get; set; }
Property Value
Padding
The space kept clear inside each cell on the side a child is aligned to.
public Spacing Padding { get; set; }
Property Value
RowSpacing
The gap between rows, in pixels.
public float RowSpacing { get; set; }
Property Value
Rows
The number of rows. At least 1; set by the constructor.
public int Rows { get; }
Property Value
VerticalAlignment
Where each child sits down its cell.
public VerticalAlignment VerticalAlignment { get; set; }
Property Value
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
elementUIElement
Returns
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
Exceptions
- ArgumentOutOfRangeException
roworcolumnis outside the grid.