Skip to main content

DxGridColumn.MinWidth Property

Specifies a column’s minimum width in pixels.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

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

Property Value

Type Default Description
Int32 50

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 Grid’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: Layout Specifics in Blazor Grid.

If there is not enough space to display all Grid columns, columns with unspecified widths can be collapsed. To prevent a column from collapsing, set its MinWidth property to a non-zero value.

<style>
    .my-class {
        width: 550px;
    }
</style>

<DxGrid Data="@Data"
            CssClass="my-class">
        <Columns>
            <DxGridDataColumn FieldName="Date" DisplayFormat="D" Width="200"/>
            <DxGridDataColumn FieldName="Forecast" Width="150" />
            <DxGridDataColumn FieldName="CloudCover" Width="150"/>
            <DxGridDataColumn FieldName="TemperatureC" Caption="@("Temp. (\x2103)")" MinWidth="80"/>
        </Columns>
</DxGrid>

@code {
    object Data { get; set; }

    protected override void OnInitialized() {
        Data = ForecastService.GetForecast().ToList();
    }
}

Grid Layout Specifics - Minimum Width is Specified

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

<style>
    .my-class {
        width: 500px;
    }
</style>

<DxGrid Data="@Data"
            CssClass="my-class">
        <Columns>
            <DxGridDataColumn FieldName="Date" DisplayFormat="D" Width="200"/>
            <DxGridDataColumn FieldName="Forecast" Width="150" />
            <DxGridDataColumn FieldName="CloudCover" Width="150"/>
            <DxGridDataColumn FieldName="TemperatureC" Caption="@("Temp. (\x2103)")" MinWidth="0"/>
        </Columns>
</DxGrid>

@code {
    object Data { get; set; }

    protected override void OnInitialized() {
        Data = ForecastService.GetForecast().ToList();
    }
}

Grid Layout Specifics - Minimum Width is Set to Zero

Implements

See Also