Skip to main content

ColumnView.PopulateColumns() Method

Creates columns for all fields in the bound data source.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v24.2.dll

Declaration

public override void PopulateColumns()

Remarks

This method clears the column collection and creates new columns for fields in the View’s bound data source. The GridColumn.FieldName property of each column created is set to the respective bound field’s name. The GridColumn.VisibleIndex property is set with respect to the position of fields within the bound data source.

This overload of the PopulateColumns method is not in effect for detail pattern Views. To populate pattern Views with columns, you need to use the method overloads that take appropriate parameters. If the pattern View is bound to a DataTable, then use the PopulateColumns method that takes a DataTable parameter. Similarly, if the pattern View is bound to a list, call PopulateColumns with a list parameter.

To create columns manually, use the methods provided by the ColumnView.Columns collection.

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 PopulateColumns() method.

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