Populating with Data
RadPivotGrid and RadFieldListControl are data-aware control, designed to display data in a tabular form. Both controls cannot work without data source. It can be any collection implementing IEnumerable interface, bounded to a DataBase or even bound to a Cube.
Data Types
Both RadPivotGrid and RadPivotFieldList have DataProvider property that can be set in the XAML or in the background. The DataProvider can be:
LocalDataSourceProvider - this is a local data provider which has ItemsSource property. The ItemsSource is a mandatory property for this DataSource. You can use any Collection that implements IEnumerable interface as ItemsSource.
XmlaDataProvider - Provides Cube data access and operations using Xmla. An OLAP cube is a method of storing data in a multidimensional form, generally for reporting purposes.
By default if you just set the DataProvider property you'll not see any visual representation of the data in RadPivotGrid, but you'll be able to see all of it in RadPivotFieldList FieldBox. To see the data in RadPivotGrid you can define your RowGroupDescription, ColumnGroupDescription and AggregateDescription and add some of the data properties in them. Another way is to drag (or check) the items in RadPivotFieldList and move them between the lists in the bottom part of RadPivotFieldList.
RadPivotFieldList is changing the DataProvider runtime and these changes are applied on RadPivotGrid only if it is using the same DataProvider. The DataProvider is the link between these two controls.
Data Provider Properties and Group Descriptions
Properties
All of the DataProviders have some common properties that you can set:
AggregatesLevel - this property is used to set the position where groups for the aggregates should be placed.
AggregatesPosition - defines whether the positon of the Aggregates will be Columns or Rows.
GroupDescriptions
Each of the DataProviders uses four collections that reflect the view of RadPivotGrid. The following collections are the essential part of generating RadPivotGrid report.
RowGroupDescriptions - the data included in the DataProvider as a part of this collection will show as Row Headers in RadPivotGrid.
ColumnGroupDescriptions - the data included in the DataProvider as a part of this collection will show as Column Headers in RadPivotGrid.
AggregateDescriptions - the data included in the DataProvider as a part of this collection will be aggregated based on the function we set and added as Cells in RadPivotGrid.
FilterDescriptions - the data added to this description will be filtered based on some condition and after that added to RadPivotGrid.
DataProvider Refresh
Each DataProvider must be refreshed to apply changes. It would also try to refresh automatically on a change. The following utilities control the Refresh behavior in various scenarios.
void Refresh() - this method unconditionally forces Refresh on the DataProvider.
bool DeferUpdates - if the value is true, the automatic Refresh is suspended for a long time. Refreshes can still be triggered calling Refresh() or automatically when some changes were made and the DeferUpdates is set to false.
For example user interactions with RadPivotFieldList can cause a lot of automatic Refresh calls, but when this property is set to true, all changes will be applied at the same time when the "Update" button is clicked to call Refresh() or the "Defer Layout Updates" is unchecked to set DeferUpdates to false.
The default value is true for the LocalDataSourceProvider and false for XmlaDataProvider and AdomdDataProvider.
IDisposable DeferRefresh() - this method is causing delay of the refresh in the current scope, for example you can use the following: using (dataProvider.DeferRefresh()) {...};. pattern if you are about to apply multiple changes in a single method scope but want to trigger one automatic Refresh instead of several. Refresh will be triggered automatically upon exit only if changes were made and DeferUpdates is set to false.
BeginInit() and EndInit() - these methods must be used when you intialize the DataProvider in the code behind. Wrapping the initialization in BeginInit() - EndInit() will suspend automatic Refreshes until the EndInit() that will unconditionally force Refresh.