Back to Devexpress

DxTreeListColumn.MinWidth Property

blazor-devexpress-dot-blazor-dot-dxtreelistcolumn-511e767b.md

latest3.5 KB
Original Source

DxTreeListColumn.MinWidth Property

Specifies a column’s minimum width in pixels.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[DefaultValue(50)]
[Parameter]
public int MinWidth { get; set; }

Property Value

TypeDefaultDescription
Int3250

A column’s minimum width in pixels.

|

Remarks

If you do not specify a column’s Width property explicitly, its value is automatically calculated based on the TreeList’s total width, other column widths, borders, and cell spacing. For additional 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.

razor
<DxTreeList Data="TreeListData" KeyFieldName="Id" ParentKeyFieldName="ParentId" CssClass="my-treelist">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" Width="400px" />
        <DxTreeListDataColumn FieldName="EmployeeName" Width="200px" />
        <DxTreeListDataColumn FieldName="StartDate" Width="100px" />
        <DxTreeListDataColumn FieldName="DueDate" MinWidth="100" />
    </Columns>
</DxTreeList>

@code {
    List<EmployeeTask> TreeListData { get; set; }

    protected override void OnInitialized() {
        TreeListData = EmployeeTaskService.GenerateData();
    }
}
css
.my-treelist{
    width: 700px;
}

Set a column’s MinWidth property to 0 to collapse the column when there is not enough space to display it.

razor
<DxTreeList Data="TreeListData" KeyFieldName="Id" ParentKeyFieldName="ParentId" CssClass="my-treelist">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" Width="400px" />
        <DxTreeListDataColumn FieldName="EmployeeName" Width="200px" />
        <DxTreeListDataColumn FieldName="StartDate" Width="100px" />
        <DxTreeListDataColumn FieldName="DueDate" MinWidth="0" />
    </Columns>
</DxTreeList>

@code {
    List<EmployeeTask> TreeListData { get; set; }

    protected override void OnInitialized() {
        TreeListData = EmployeeTaskService.GenerateData();
    }
}
# [CSS](#tab/tabid-treelistcolumn-minwidth-zero-css)
```CSS
.my-treelist{
    width: 700px;
}

Implements

MinWidth

MinWidth

See Also

DxTreeListColumn Class

DxTreeListColumn Members

DevExpress.Blazor Namespace