Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxGridColumn.MinWidth Property

Specifies a column’s minimum width in pixels.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[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.

Razor
<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.

Razor
<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