How to Load XML Data from a File at Runtime

This example contains a dashboard bound to an object data source with fake data whose structure is defined by an XML schema. The actual data is loaded at runtime from an XML file.

To load the data, click the Load Data custom button in the dashboard title. The button is created by handling the CustomizeDashboardTitle event. Its click action calls the DashboardViewer.ReloadData method that triggers the DashboardViewer.DataLoading event. The actual data are obtained within the event handler and assigned to the e.Data property.

screenshot

The dashboard class is created in Visual Studio designer. The dashboard is bound to an object data source built from XML schema contained in an XSD file. The dashboard designer displays auto-generated fake data.

The data source is created using the Data Source Wizard...

DataSourceWizard

... and set up as illustrated in the picture below:

DataSource