Skip to main content

ColumnViewOptionsBehavior.AutoPopulateColumns Property

Gets or sets whether to create columns automatically for all fields in the underlying data source (when binding the grid and if the View doesn’t contain any columns). When bound to a data source, the grid does not generate columns for properties of collection types.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

[DefaultValue(true)]
[XtraSerializableProperty]
public virtual bool AutoPopulateColumns { get; set; }

Property Value

Type Default Description
Boolean true

true if the columns are created automatically when the View doesn’t contain any columns; otherwise, false.

Property Paths

You can access this nested property as listed below:

Object Type Path to AutoPopulateColumns
ColumnView
.OptionsBehavior .AutoPopulateColumns

Remarks

This property determines whether the BaseView.PopulateColumns method is called automatically when a data source is assigned to a View which doesn’t contain any columns. The BaseView.PopulateColumns method creates GridColumn objects for all the fields in the underlying data source and make these columns visible.

Set the AutoPopulateColumns property to false to prevent columns from being automatically created.

Note

A business object bound to a Grid Control may contain properties of collection types (e.g., of the List<> type). These properties instruct the Grid to enable master-detail mode (see Working with Master-Detail Relationships in Code). Columns corresponding to collection properties are not created in a master View.

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

Note

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