GridPanel - SirePi/duality-ui GitHub Wiki

The CanvasPanel layouts its child Controls in a grid, and requires that each child to define its own Cell. Derives from ControlsContainer.

In addition to the ControlsContainer's base properties and delegates, it also exposes:

  • Property Columns - A string array that is used to define the amount of columns available in the grid and their size, both as absolute values or the percentage of the remaining unassigned space that is available for each single column. For example, to have three columns, where the first and third one take 20% of the available space, and the second takes the 60%, you should set the array as ["20*", "60*", "20*"], or ["1*", "3*", "1*"] (divide each by 20, the proportions stay the same). if you want to have the first column to always be 200 pixels wide, the array will be ["200", "3*", "1*"], with the remaining space shared between the second and third column in a proportion of 3 : 1.
  • Property Rows - A string array that is used to define the amount of rows available in the grid and their size, both as absolute values or the percentage of the remaining unassigned space that is available for each single row.

CellInfo

The CellInfo struct is used to set a Control's place and size inside a GridPanel. It exposes the following members:

  • Property Column - the starting column's index (base 0, default 0).
  • Property Row - the starting row's index (base 0, default 0).
  • Property ColumnSpan - how many columns will the Control fill (default 1).
  • Property RowSpan - how many rows will the Control fill (default 1).

If the child Control's StretchToFill property is set to false, it will use both its Size dimensions, and will appear centered in the desired Cell slot.