TablePanelEntity.Style Property
Gets or sets the size type of the current row/column.
Namespace: DevExpress.Utils.Layout
Assembly: DevExpress.Utils.v24.2.dll
NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core
#Declaration
[DefaultValue(TablePanelEntityStyle.AutoSize)]
[DXCategory("Layout")]
public TablePanelEntityStyle Style { get; set; }
#Property Value
Type | Default | Description |
---|---|---|
Table |
Auto |
The size type of the current row/column. |
Available values:
Name | Description |
---|---|
Auto |
Rows/columns are automatically resized to match their contents. Width and Height settings of these columns/rows are ignored. The Auto You can also enable the Table |
Absolute | A row/column has a fixed width/height, in pixels. If the last row/column is of the Absolute size type and the Table |
Relative | Rows/columns of this size type divide the available space according to the ratio specified by their sizes. When you enable the Table |
Separator | Rows and columns of this style serve as visual delimiters between their neighboring rows and columns. Separators cannot be resized and ignore their Table |
#Remarks
tablePanel1.Rows[1].Style = DevExpress.Utils.Layout.TablePanelEntityStyle.Absolute;
tablePanel1.Rows[1].Height = 50;
The TablePanel 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, 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 Relative type.
#Auto-Size Mode
You can use the TablePanel.AutoSize and TablePanel.AutoSizeMode properties to make the panel auto-adjust its size to fit its contents. The Style property of individual rows and columns is interpreted as follows when you enable auto-size mode for the panel:
- Set the Style property for the row/column to Absolute to fix the row/column length.
- Set the Style property to AutoSize to make the row/column resize itself according to the row/column contents.
- The Relative option assigned to the Style property is interpreted as AutoSize.
#Example
The following example adds rows and columns to a TablePanel, and then places a button to the panel’s top-left cell.
The created rows and columns are of different size types, as demonstrated in the image below.
using DevExpress.Utils.Layout;
tablePanel1.Columns.Clear();
tablePanel1.Columns.Add(new TablePanelColumn(TablePanelEntityStyle.AutoSize, 0));
tablePanel1.Columns.Add(new TablePanelColumn(TablePanelEntityStyle.Absolute, 40));
tablePanel1.Columns.Add(new TablePanelColumn(TablePanelEntityStyle.Relative, 2));
tablePanel1.Columns.Add(new TablePanelColumn(TablePanelEntityStyle.Relative, 5));
tablePanel1.Rows.Clear();
tablePanel1.Rows.Add(new TablePanelRow(TablePanelEntityStyle.AutoSize, 0));
tablePanel1.Rows.Add(new TablePanelRow(TablePanelEntityStyle.Absolute, 50));
tablePanel1.Rows.Add(new TablePanelRow(TablePanelEntityStyle.Relative, 1));
tablePanel1.Rows.Add(new TablePanelRow(TablePanelEntityStyle.Relative, 3));
tablePanel1.Controls.Add(simpleButton1);
tablePanel1.SetCell(simpleButton1, 0, 0);