DxTreeListColumn.Width Property
Specifies column width in CSS units.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v25.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[DefaultValue(null)]
[Parameter]
public string Width { get; set; }
Property Value
Type | Default | Description |
---|---|---|
String | null | The column’s width. |
Remarks
You can specify the Width
property in any relative or absolute units that your browser supports.
Note
If you set the Width
in em
units, the TreeList component converts this value from em
to pixels on page load. The TreeList does not automatically update the Width
value when the base em
size changes at runtime (due to CSS rules or window resizing).
@inject EmployeeTaskService EmployeeTaskService
<DxTreeList Data="TreeListData" KeyFieldName="Id" ParentKeyFieldName="ParentId">
<Columns>
<DxTreeListSelectionColumn Width="100px" />
<DxTreeListDataColumn FieldName="Name" Caption="Task" Width="40%" />
<DxTreeListDataColumn FieldName="EmployeeName" />
<DxTreeListDataColumn FieldName="StartDate" />
<DxTreeListDataColumn FieldName="DueDate" />
</Columns>
</DxTreeList>
@code {
List<EmployeeTask> TreeListData { get; set; }
protected override void OnInitialized() {
TreeListData = EmployeeTaskService.GenerateData();
}
}
If you do not specify column Width
property explicitly, its value is automatically calculated based on the TreeList’s total width, other column widths, borders, and cell spacing. For more information on how this algorithm works in different scenarios, refer to the following topic: Column Layout Specifics in Blazor TreeList.
The TreeList component can automatically collapse columns with unspecified widths if there is not enough space to display all columns. To prevent a column from collapsing, set its MinWidth property to a non-zero value.