Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Fundamentals
   [Collapse]Binding to Data
     Binding to Data Overview
    [Collapse]Items Source Configuration Wizard
      ADO.NET Data
      Entity Framework Data
      LINQ to SQL
      WCF Data Services
      XPO Data Source
      IList and IEnumerable Data Sources
      OLAP Cube
      ICollectionView Specifics
    [Expand]OLAP Data Source
    [Expand]Database Server Mode
     Unbound Fields
     Local Data Stores
     Asynchronous Mode
   [Expand]Data Shaping
   [Expand]Data Analysis
   [Expand]Layout
   [Expand]Printing and Exporting
   [Expand]Appearance
   [Expand]MVVM Enhancements
   [Expand]Miscellaneous
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

ADO.NET Data

The Items Source Configuration Wizard allows you to bind the PivotGridControl to an ADO.NET DataSet at design time. You can also bind the PivotGridControl to a DataSet in code. This topic explains how to do this.

Expanded Binding to a DataSet at Design Time

  1. Click the PivotGridControl's smart tag and select the Items Source Wizard command.

  2. In the invoked Items Source Configuration Wizard, select ADO.NET Typed DataSet...

    ... and click the New Data Source button placed within the Data Sources area.

  3. The following message will appear.

    Click OK.

  4. In the invoked Data Source Configuration Wizard, you can establish a connection to the required database.

    To learn how to use the Data Source Configuration Wizard, see the following MSDN topic: Data Source Configuration Wizard.

    Important

    After you created the data source, rebuild the solution.

  5. After creating a data source, click Items Source Wizard again.

  6. In the invoked Items Source Configuration Wizard, select the created DataSet.

    Click Next.

  7. On the next page, select the required binding method.

    • Simple Binding - allows you to bind the PivotGridControl to a DataSet directly.
    • Manipulating Data via ICollectionView - allows you to bind the PivotGridControl to a DataSet using the ICollectionView component, which enables collections to have the functionalities of current record management, custom sorting, filtering, and grouping. To learn more, see ICollectionView Specifics.

    Select Simple Binding and click Next.

  8. On the final page, you can specify the table from the created DataSet.

    Select the required table and click Finish.

  9. The PivotGridControl will be bound to the created DataSet.

    You can now use the Retrieve Fiels command to retrieve the available data source fields.

    Note

    Note that the Items Source Configuration Wizard adds the created data source to window resources.

    Then, the PivotGridControl is bound to the created data source.

Expanded Binding to a DataSet in Code

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E2121.

The following example demonstrates how to bind the PivotGridControl to a "SalesPerson" view in the nwind.mdb database, which is shipped with the installation. The control will be used to analyse sales per country, customers, product categories and years.

The following steps were used to created this example:

  1. A typed dataset is created from the database at design time.
  2. Instances of SalesPersonDataTable and SalesPersonTableAdapter objects are created.
  3. The PivotGridControl is bound to the SalesPersonDataTable instance via the PivotGridControl.DataSource property.
  4. The table is filled with data in the Window_Loaded event handler.

The pivot grid fields that will represent data source fields are created in XAML markup. They are positioned within appropriate areas to analyze the data in the way you want.

Note that if you want to see an example of how to programmatically add pivot grid fields, please refer to the How to: Bind a PivotGrid to an MS Access Database Programmatically tutorial.

Is this topic helpful?​​​​​​​