GridView.ColumnWidthChanged Event
Occurs after a column’s width has been changed.
Namespace: DevExpress.XtraGrid.Views.Grid
Assembly: DevExpress.XtraGrid.v24.1.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
Declaration
Event Data
The ColumnWidthChanged event's data class is ColumnEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Column | Gets the column being processed. |
Remarks
This event occurs in the following cases:
- an end-user has dragged a column’s right edge, and thus modified its width;
- a column’s width has been modified via the GridColumn.Resize method.
private void gridView1_ColumnWidthChanged(object sender, DevExpress.XtraGrid.Views.Base.ColumnEventArgs e) {
e.Column.Width = Math.Min(e.Column.Width, colAddress.Width);
}
The ColumnWidthChanged
event isn’t fired when a column’s width is changed via the GridColumn.Width property.
This event also isn’t fired when the following conditions are met:
- the GridOptionsView.ColumnAutoWidth option is set to
true
- a column’s width is changed as a result of modifying the View’s width.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ColumnWidthChanged event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.