wpf-devexpress-dot-xpf-dot-grid-dot-datacontrolbase-d59f8029.md
Occurs each time an individual column is auto-generated.
Namespace : DevExpress.Xpf.Grid
Assembly : DevExpress.Xpf.Grid.v25.2.Core.dll
NuGet Package : DevExpress.Wpf.Grid.Core
public event AutoGeneratingColumnEventHandler AutoGeneratingColumn
Public Event AutoGeneratingColumn As AutoGeneratingColumnEventHandler
The AutoGeneratingColumn event's data class is DevExpress.Xpf.Grid.AutoGeneratingColumnEventArgs.
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;
}
}
Private Sub grid_AutoGeneratingColumn(ByVal sender As Object, ByVal e As DevExpress.Xpf.Grid.AutoGeneratingColumnEventArgs)
If e.Column.FieldName = "IsSelected" Then
e.Cancel = True
End If
End Sub
See Also