Skip to main content

DevExpress v24.1 Update — Your Feedback Matters

Our What's New in v24.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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];