Skip to main content

DxGridColumn.WidthChanged Event

Fires when a column’s width changes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[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 example below, 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();
    }
}

Grid: Change Width

See Also