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.WidthChanged Event

Fires when a column’s width changes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public EventCallback<string> WidthChanged { get; set; }

#Parameters

Type Description
String

The new Width property value.

#Remarks

You can specify the column’s Width property value in any absolute or relative units that your browser supports. The WidthChanged event fires when a column’s width changes.

In the following code snippet, the WidthChanged event fires after a user resizes the Date column:

@inject WeatherForecastService ForecastService

<DxGrid Data="@Data" ColumnResizeMode="GridColumnResizeMode.NextColumn">
    <Columns>
        <DxGridDataColumn FieldName="Date" DisplayFormat="D"
                          Width="150px" WidthChanged=@OnWidthChanged />
        <DxGridDataColumn FieldName="TemperatureC" />
        <DxGridDataColumn FieldName="TemperatureF" />
    </Columns>
</DxGrid>

The new width: @Message

@code {
    object Data { get; set; }
    string Message { get; set; }
    void OnWidthChanged(string NewValue) {
        Message = NewValue;
    }
    protected override void OnInitialized() {
        Data = ForecastService.GetForecast();
    }
}

See Also