Skip to main content
.NET 6.0+

WinColumnsListEditor.CustomizeGridColumn Event

Occurs when a column is created.

Namespace: DevExpress.ExpressApp.Win.Editors

Assembly: DevExpress.ExpressApp.Win.v24.1.dll

NuGet Package: DevExpress.ExpressApp.Win

Declaration

public event EventHandler<CustomizeGridColumnEventArgs> CustomizeGridColumn

Event Data

The CustomizeGridColumn event's data class is DevExpress.ExpressApp.Win.Editors.CustomizeGridColumnEventArgs.

Remarks

Handle this event to customize column settings. Use the e.GridColumn parameter to access the column instance. The following example demonstrates the Controller that handles the CustomizeGridColumn event and makes the FullName column of the Contact object’s List View fixed.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Win.Editors;
// ...
public class CustomizeGridColumnController : ObjectViewController<ListView, Contact> {
    protected override void OnActivated() {
        base.OnActivated();
        GridListEditor listEditor = ((ListView)View).Editor as GridListEditor;
        if (listEditor != null) {
            listEditor.CustomizeGridColumn += listEditor_CustomizeGridColumn;
        }
    }
    void listEditor_CustomizeGridColumn(object sender, CustomizeGridColumnEventArgs e) {
        if (e.GridColumn.FieldName == "FullName") {
            e.GridColumn.Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left;
        }
    }
}

Important

Subscribe to CustomizeGridColumn in the overridden OnActivated method. Do not use the OnViewControlsCreated method for this purpose - columns are already initialized at that moment and the event will not be triggered.

See Also