ColumnView.PopulateColumns() Method

Creates columns for all fields in the bound data source.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

public override void PopulateColumns()
Public Overrides Sub 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.

See Also