Skip to main content

PivotGridControl.DataSource Property

Gets or sets the object used as the data source for the current control.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v24.2.dll

Declaration

[DefaultValue(null)]
public object DataSource { get; set; }

Property Value

Type Default Description
Object null

The object used as the data source.

Remarks

Objects such as a DataTable, a DataView, a IList, a IListSource and IBindingList can be used as data sources.

If some of the data source field values are custom objects (not numeric or string values), use the PivotGridOptionsData.CustomObjectConverter property to specify a serializer to be used to process them. Otherwise, you will be unable to save/restore the Pivot Grid Control layout and data to/from a file or stream.

Assigning a new value to the PivotGridControl.DataMember or DataSource property raises the PivotGridControl.DataSourceChanged event, and causes a Pivot Grid Control update. The Pivot Grid Control is not updated automatically when the current data source is modified. To force the Pivot Grid Control update, use the PivotGridControl.RefreshData method.

Note

The PivotGridControl.DataSourceChanged event is raised and the Pivot Grid Control is updated when the data source implementing the IBindingList interface raises the ListChanged event of the PropertyDescriptorAdded, PropertyDescriptorDeleted, PropertyDescriptorChanged or Reset type.

To retrieve data from a data source asynchronously, assign it using the PivotGridControl.SetDataSourceAsync method instead of the DataSource property.

To learn more on data binding, see Binding to Data.

The following code snippets (auto-collected from DevExpress Examples) contain references to the DataSource 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