XML Data
- 2 minutes to read
The Data Source Configuration Wizard allows you to bind the PivotGridControl to XML files created using the DataSet.WriteXML method (see Binding Controls to XML Data). This topic guides your through the stesps needed to do this.
Click the Data Source Wizard button placed on the PivotGridControl or use the corresponding command in the control’s smart tag.
In the invoked Data Source Configuration Wizard, select XML Data…
… and click Next.
On the next page, select the required binding method and click Next.
On the final page, specify the following settings.
- Xml Data Path - Specifies the path to the required XML data file manually or click the Load Xml… button and locate the file.
- Table - Specifies a data table.
Click Finish.
The following code will be generated by the Data Source Configuration Wizard.
public Form1() { InitializeComponent(); // This line of code is generated by Data Source Configuration Wizard // Create a new DataSet System.Data.DataSet xmlDataSet = new System.Data.DataSet("XML DataSet"); // Load the XML document to the DataSet xmlDataSet.ReadXml(@"C:\temp\WebsiteStatisticsData.xml"); // This line of code is generated by Data Source Configuration Wizard pivotGridControl1.DataSource = xmlDataSet.Tables["Data"]; }
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.