Table of Contents

Class GridLayout

Namespace
MagicUI.Elements
Assembly
MagicUI.dll

A generic grid layout with user-specified rows and columns

public class GridLayout : Layout, ILayoutParent
Inheritance
GridLayout
Implements
Inherited Members
Extension Methods

Remarks

Grid rows and columns are sized semi-dynamically. A row/column with the unit AbsoluteMin will be sized at the specified size and grow to fit children as needed. If a child spans multiple of these rows/columns, each row/column will be allocated height/width proportional to the child's size (assuming it needs to grow at all). Rows/columns with the Proportional unit will proportionally split the remaining available minimum width/height, and grow with each other in step until all children are able to fit.

Constructors

GridLayout(LayoutRoot, string)

Creates a grid layout

public GridLayout(LayoutRoot onLayout, string name = "New GridLayout")

Parameters

onLayout LayoutRoot

The layout root to draw the grid layout on

name string

the name of the grid layout

Fields

Column

Attached property for column. This is the first column that the item will appear in the grid. Defaults to 0 and is capped at the last column.

public static AttachedProperty<int> Column

Field Value

AttachedProperty<int>

ColumnSpan

Attached property for column span. This is the maximum number of columns that an item will occupy. Defaults to 1.

public static AttachedProperty<int> ColumnSpan

Field Value

AttachedProperty<int>

Row

Attached property for row. This is the first row that the item will appear in the grid. Defaults to 0 and is capped at the last row.

public static AttachedProperty<int> Row

Field Value

AttachedProperty<int>

RowSpan

Attached property for row span. This is the maximum number of rows that an item will occupy. Defaults to 1.

public static AttachedProperty<int> RowSpan

Field Value

AttachedProperty<int>

Properties

ColumnDefinitions

Definition of the number of columns, their sizes, and their types. By default this is empty. If the grid is measured with empty column definitions, one will be added for you with a minimum height of 0px.

public NotifyingCollection<GridDimension> ColumnDefinitions { get; }

Property Value

NotifyingCollection<GridDimension>

MinHeight

The minimum height to be occupied by the grid

public float MinHeight { get; set; }

Property Value

float

MinWidth

The minimum width to be occupied by the grid

public float MinWidth { get; set; }

Property Value

float

RowDefinitions

Definition of the number of rows, their sizes, and their types. By default this is empty. If the grid is measured with empty row definitions, one will be added for you with a minimum height of 0px.

public NotifyingCollection<GridDimension> RowDefinitions { get; }

Property Value

NotifyingCollection<GridDimension>

Methods

ArrangeOverride(Vector2)

Internal implementation to position the object within the allocated space.

protected override void ArrangeOverride(Vector2 alignedTopLeftCorner)

Parameters

alignedTopLeftCorner Vector2

The space available for the element.

DestroyOverride()

Internal implementation to perform any additional cleanup when the element is destroyed

protected override void DestroyOverride()

MeasureOverride()

Internal implementation to calculate desired size.

protected override Vector2 MeasureOverride()

Returns

Vector2