Back to Devexpress

AutoGeneratingColumnEventArgs.Column Property

maui-devexpress-dot-maui-dot-datagrid-dot-autogeneratingcolumneventargs.md

latest1.7 KB
Original Source

AutoGeneratingColumnEventArgs.Column Property

Gets the column being generated automatically.

Namespace : DevExpress.Maui.DataGrid

Assembly : DevExpress.Maui.DataGrid.dll

NuGet Package : DevExpress.Maui.DataGrid

Declaration

csharp
public GridColumn Column { get; }

Property Value

TypeDescription
GridColumn

A GridColumn class descendant that specifies the column to be added to the grid.

|

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.

xaml
<dxg:DataGridView x:Name="grid" ItemsSource="{Binding Employees}" 
                  AutoGenerateColumnsMode="Auto"
                  AutoGeneratingColumn="Grid_AutoGeneratingColumn">
    <!-- ... -->
</dxg:DataGridView>
csharp
using DevExpress.Maui.DataGrid;
// ...

private void Grid_AutoGeneratingColumn(object sender, AutoGeneratingColumnEventArgs e) {
    if (e.Column.FieldName == "Access")
        e.Column.Caption = "Access Level";
    if (e.Column.FieldName == "Photo")
        e.Cancel = true;
}

See Also

AutoGeneratingColumnEventArgs Class

AutoGeneratingColumnEventArgs Members

DevExpress.Maui.DataGrid Namespace