Skip to main content
A newer version of this page is available. .

How to: Automatically Create Grid Columns

The following example demonstrates how to automatically populate a grid with all the columns from its data source. This might be required, when it is necessary to show all columns from a data source, and no specific options should be defined for any column.

To accomplish this task, set the DataControlBase.AutoGenerateColumns property to AutoGenerateColumnsMode.AddNew, AutoGenerateColumnsMode.KeepOld or AutoGenerateColumnsMode.RemoveOld.

View Example

<dxg:GridControl x:Name="grid" ItemsSource="{x:Static local:SimpleData.Numbers}" AutoGenerateColumns="AddNew" />