Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DataGridView.AutoGeneratingColumn Event

Occurs each time an individual column is generated automatically.

Namespace: DevExpress.Maui.DataGrid

Assembly: DevExpress.Maui.DataGrid.dll

NuGet Package: DevExpress.Maui.DataGrid

#Declaration

C#
public event EventHandler<AutoGeneratingColumnEventArgs> AutoGeneratingColumn

#Event Data

The AutoGeneratingColumn event's data class is AutoGeneratingColumnEventArgs. The following properties provide information specific to this event:

Property Description
Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
Column Gets the column being generated automatically.

#Remarks

The grid automatically creates columns based on the bound data source if you do not specify a collection of grid columns (DataGridView.Columns). You can use the DataGridView.AutoGenerateColumnsMode property to prevent columns from being automatically created or set another mode of auto generating columns.

#Example

This example shows how to use the AutoGeneratingColumn event to modify an auto-generated column at the time it is created, or cancel the generation of a column.

<dxg:DataGridView x:Name="grid" ItemsSource="{Binding Employees}" 
                  AutoGenerateColumnsMode="Auto"
                  AutoGeneratingColumn="Grid_AutoGeneratingColumn">
    <!-- ... -->
</dxg:DataGridView>
See Also