Monsalma Data Grid for .NET MAUI – Column Width
Published:
Modified:
DataGridLengthType enum
Fixed
FixedPercentage
RemainderProportional
FitContent
DataGridLengthType
is internally used in DataGridLength
class. DataGridLength
contains the length type field (DataGridLengthType
) and the length value field (double
).
Fixed
is used to define constant length in DIU / DIP (Device Independent Unit / Device Independent Pixel). For example, "100"
would be converted to DataGridLength
object with Type
Fixed
and Value
100.
FixedPercentage
defines a length respective to parent length. For example, "20%"
would be converted to FixedPercentage
/ 20.
RemainderProportional
is used to define a column which takes a portion of the remaining width. First, width is allocated for all columns with width type Fixed
, FixedPercentage
or FitContent
. Then the remaining width is calculated and split, based on the value provided, between all columns with width type RemainderProportional
. For example, "*"
would be converted to RemainderProportional
/ 1, “3*” to RemainderProportional
/ 3. The "3*"
column would take 3 times more space than the “*” column.
We use FitContent
when we want a column to take as much space as needed, even if that makes the data grid grow over the bounds of the parent control (horizontal scroll bar is enabled in that case). "Auto"
is converted to a DataGridLength
object with Type
(FitContent
Value
is irrelevant in this case).
DataGridMinMaxLengthType enum
Absolute
ParentPercentage
Similarly, DataGridMinMaxLengthType
is used internally in DataGridMinMaxLength
class (Type
field).
Absolute
is equivalent to DataGridLengthType.Fixed
.
ParentPercentage
is equivalent to DataGridLengthType.FixedPercentage
.