IList and IEnumerable Data Sources

  • 2 minutes to read

The Data Source Configuration Wizard allows you to bind the PivotGridControl to any object that implements the IList or IEnumerable interfaces (to learn more about such objects, see Traditional Data Binding Methods). This topic guides you through the steps needed to do this.


In this topic, the data class from the following example will be used: How to: Bind a Control to Data Created at Runtime.

  1. Click the Data Source Wizard button placed on the PivotGridControl or use the corresponding command in the control's smart tag.


  2. In the invoked Data Source Configuration Wizard, select IList/IEnumerable...


    ... and click Next.

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


    Select Direct Binding to Data Source and click Next.

  4. On the final page, you need to specify the name of the required data class.


    Start typing the name of the data class.


    Then, select the required class from the list of classes offered by the Data Source Configuration Wizard and click Finish.

  5. The following code will be generated by the Data Source Configuration Wizard.

    public Form1()
                // This line of code is generated by the Data Source Configuration Wizard
                pivotGridControl1.DataSource = new System.Collections.Generic.List<WinFormsPivot.Record>();

    You can work now with the created data source at runtime. For instance, to retrieve fields from the connected data source, call the PivotGridControl.RetrieveFields method.