How to: Bind a Control to Data in an XML File

This example demonstrates a way of binding a data-aware control (XtraGrid, XtraPivotGrid, XtraVerticalGrid, etc.) to data stored in an XML file. Note that specific controls may need additional customization after the control is bound to a data source. For more information refer to documentation of the corresponding control.

The code sample below binds a GridControl to XML data stored in an XML file.


// Create a DataSet and fill it with data from an XML file.
DataSet xmlDataSet = new DataSet();
xmlDataSet.ReadXml("e:\\DBs\\Cars.xml");

// Bind the grid to the DataSet.
gridControl1.DataSource = xmlDataSet.Tables[0];