RowDefinition.SizeType Property
Gets or sets the row’s size type in a table layout.
Namespace: DevExpress.XtraLayout
Assembly: DevExpress.XtraLayout.v24.2.dll
Declaration
Property Value
Type | Description |
---|---|
SizeType | A value that specifies the row’s size type. |
Remarks
In a table layout, a group’s height is distributed among rows according to their size types. Rows support three size types:
- Absolute - The row has a fixed height specified by the RowDefinition.Height property, whose value is the number of pixels.
- Percent - The row occupies a certain percentage of the total group height. The RowDefinition.Height property value is the percentage value. When a layout is resized, rows of the Percent type are resized accordingly.
- AutoSize - The row height is automatically adjusted to best fit the row’s contents. The RowDefinition.Height property is ignored.
A table layout may contain rows and columns of different size types simultaneously. In this case, available space is distributed between rows and columns in the following order:
- First of all, space is allocated for rows/columns of the Absolute type.
- Second, space is allocated for rows/columns of the AutoSize type.
- Finally, the remaining space is distributed among rows/columns of the Percent type.
By default, after enabling table layout mode, two rows are automatically created. Their SizeType properties are set to Percent, and the Height properties are set to 50, so they share the table layout equally. If you then add a new row at design time or append a new row with the default settings in code, the new row’s height type will be AutoSize.
Percent Columns/Rows
Each time a column/row of the Percent size type is added to the table layout, or the size is changed for an existing Percent column/row, the Layout Control recalculates the sizes (ColumnDefinition.Width or RowDefinition.Height) of all existing Percent items, so that their sum equals to 100%, while keeping the proportions between the affected items.
Consider a table layout that contains two Percent rows whose widths are 40% and 60% respectively.
When you add another Percent row with the height equal to 80%, the heights of all the three rows will be automatically recalculated according to the expressions:
New height of row 1 = 40%*100% / (40% + 60% + 80%) = 22.222...%
New height of row 2 = 60%*100% / (40% + 60% + 80%) = 33.333...%
New height of row 3 = 80%*100% / (40% + 60% + 80%) = 44.444...%
In the case of multiple row modifications, you may want to avoid height recalculation of Percent columns/rows until all the modifications are made. To accomplish this, wrap the modification code in the LayoutControl.BeginUpdate and LayoutControl.EndUpdate method calls.