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.v20.1.Core.dll

Declaration

public AutoGenerateColumnsMode AutoGenerateColumns { get; set; }
Public Property AutoGenerateColumns As AutoGenerateColumnsMode

Property Value

Type Default Description
AutoGenerateColumnsMode

None

The way columns are generated.

Remarks

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

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

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

See Also