Skip to main content

DataGridView.AutoGeneratingColumn Event

Occurs each time an individual column is generated automatically.

Namespace: DevExpress.XamarinForms.DataGrid

Assembly: DevExpress.XamarinForms.Grid.dll

NuGet Package: DevExpress.XamarinForms.Grid

#Declaration

C#
public event AutoGeneratingColumnEventHandler 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