Calculating the Height and Width of the DataGrid

A DataGrid consists of multiple UI elements that affect the height and width of the entire DataGrid. For some combinations the DataGrid adjusts the height and width automatically.

The table below shows an overview of the various cases.

Scenario

Definition of Designtime Runtime Display
Absolute width Property width of DataGrid: Not defined

Property columnWidth of DataGridSegmentCols: Absolute and defined in the same unit (for example px)

The width of the entire DataGrid is calculated from the sum of the width of all segment columns in the specified unit (e.g. px).
Property width of DataGrid: Absolute and defined in the same unit (for example px)

Property columnWidth of DataGridSegmentCols: Absolute and defined in the same unit (for example px)

No effect
Property width of DataGrid: Not defined

Property columnWidth of DataGridSegmentCols: Absolute and defined in different units (for example, px and em)

No effect
Relative width Property width of DataGrid: Not defined

Property columnWidth of DataGridSegmentCols: At least one row defined as a percentage

The width of the entire DataGrid is set to 100%.
Property width of DataGrid: Defined with a percentage

Property columnWidth of DataGridSegmentCols: At least one row defined as a percentage

No effect
Absolute height Property height of DataGrid:

Property rowHeight of DataGridSegmentRows: Absolute and defined in the same unit (for example px)

The width of the entire DataGrid is calculated by the sum of the height of all segment rows in the specified unit (e.g. px).
Property height of DataGrid: Absolute and defined in the same unit (for example px)

Property rowHeight of DataGridSegmentRows: Absolute and defined in the same unit (for example px)

No effect
Property height of DataGrid: not defined

Property rowHeight of DataGridSegmentRows: absolute and defined in different units (for example, px and em)

No effect
Relative height Property height of DataGrid: Not defined

Property rowHeight of DataGridSegmentRows: At least one row defined as a percentage

The height of the entire DataGrid is set to 100%.
Property height of DataGrid: Defined with a percentage

Property rowHeight of DataGridSegmentRows: At least one row defined as a percentage

No effect