Skip to main content

DataControlBase.AutoGenerateColumns Property

Gets or sets whether columns should be created automatically for all properties in the underlying data source when the View does not contain any columns. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v24.1.Core.dll

NuGet Package: DevExpress.Wpf.Grid.Core


public AutoGenerateColumnsMode AutoGenerateColumns { get; set; }

Property Value

Type Default Description
AutoGenerateColumnsMode None

The way columns are generated.

Available values:

Name Description

Doesn’t create columns.


Creates columns for all properties in a datasource if the grid doesn’t contain any columns.


Creates columns for all properties in a datasource, preserving the columns the grid already contains.


Creates columns for all properties in a datasource, removing columns the grid already contains.


This property specifies the way the DataControlBase.PopulateColumns method works.

 <dxg:GridControl x:Name="grid"
                  ItemsSource="{x:Static common:SalesProductData.Data}"
        <dxg:GridColumn FieldName="State"/>
        <dxg:GridColumn FieldName="Category"/>
        <dxg:TableView x:Name="gridView"/>

View Example: Generate Columns for All Fields in a Data Source

Set the AutoGenerateColumns property to AutoGenerateColumnsMode.None to prevent columns from being automatically created.

Use the DisplayAttribute or the BrowsableAttribute to prevent the automatic generation of specific properties:

public class GridDataObject {
    public string Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }

Handle the AutoGeneratedColumns or the AutoGeneratingColumn event to specify column settings (assign column editors, hide individual columns, and so on).

The following code snippets (auto-collected from DevExpress Examples) contain references to the AutoGenerateColumns property.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also