WCF Data Services
- 2 minutes to read
The Data Source Configuration Wizard allows you to bind the PivotGridControl to data using WCF Data Services. This topic guides you through the steps needed to do this.
Click the Data Source Wizard button placed on the PivotGridControl or use a corresponding command in a control’s smart tag.
In the invoked Data Source Configuration Wizard, select WCF Data Services…
… and click the New Data Source button placed within the Data Sources area.
The following message will appear.
Click OK.
Specify the address of a data service.
To learn how to create a WCF data service, see the following topics: Creating the Data Service.
Important
After you creat a service reference, rebuild the solution.
After creating a service reference, click the Data Source Wizard again.
In the invoked Data Source Configuration Wizard, select the created service.
Click Next.
On the next page, select the required binding method.
- Direct Binding to Data Source - allows you to bind the PivotGridControl to a data source directly.
- Binding via the BindingSource Component - allows you to bind the PivotGridControl to a data source using the BindingSource component, which simplifies design-time data binding. To learn more, see BindingSource Component Specifics.
- Server Side Data Processing - allows you to bind the PivotGridControl to large data sources. To learn more, see Database Server Mode.
Select Direct Binding to Data Source and click Next.
On the final page, specify the service URI (Service Root) and click the Test Connection button.
Then, select the required Table and click Finish.
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 WinFormsPivot.ServiceReference1.NorthwindEntities(new System.Uri("http://localhost:65455/Northwind.svc/")).SalesPersons.ToList(); }
You can now work with the created data source at runtime. For instance, to retrieve fields from the connected data source, call the PivotGridControl.RetrieveFields method.