DataControlBase.AutoGeneratingColumn Event
In This Article
Occurs each time an individual column is auto-generated.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v24.2.Core.dll
NuGet Package: DevExpress.Wpf.Grid.Core
#Declaration
#Event Data
The AutoGeneratingColumn event's data class is DevExpress.Xpf.Grid.AutoGeneratingColumnEventArgs.
#Remarks
Use the AutoGeneratingColumn event to change or cancel an automatically generated column when it is created.
The following example prevents a grid from generating a column based on the IsSelected data field:
<dxg:GridControl AutoGenerateColumns="AddNew"
EnableSmartColumnsGeneration="True"
AutoGeneratingColumn="grid_AutoGeneratingColumn"
ItemsSource="{Binding Items}">
<!--...-->
</dxg:GridControl>
private void grid_AutoGeneratingColumn(object sender, DevExpress.Xpf.Grid.AutoGeneratingColumnEventArgs e) {
if (e.Column.FieldName == "IsSelected") {
e.Cancel = true;
}
}
See Also