Skip to main content
A newer version of this page is available. .

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.

Note

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.

    WinPivot_DataSourceButton

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

    DataSourceConfigurationWizard_SelectIList

    … and click Next.

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

    DataSourceConfigurationWizard_AdoNet_BindingMethod

    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.

    DataSourceConfigurationWizard_IList_Finish

    Start typing the name of the data class.

    DataSourceConfigurationWizard_IList_ClassName

    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()
            {
                InitializeComponent();
                // 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.