Skip to main content

DashboardDesigner.DataLoading Event

Allows you to provide data for the DashboardObjectDataSource.

Namespace: DevExpress.DashboardWin

Assembly: DevExpress.Dashboard.v22.1.Win.dll


public event DataLoadingEventHandler DataLoading

Event Data

The DataLoading event's data class is DataLoadingEventArgs. The following properties provide information specific to this event:

Property Description
Data Gets or sets data for the current data source.
DataId Gets an object data source’s unique identifier.
DataSourceComponentName Get the component name of the data source for which the event has been raised.
DataSourceName Gets the name of the data source for which the event has been raised.
OverwriteDataSourceProperty Specifies whether the DataSource and DataMember properties of the DashboardObjectDataSource are set when data is supplied in the event handler.
Parameters Provides access to parameter values passed to the object data source.


The DataLoading event is raised when the dashboard loads data from the DashboardObjectDataSource. Use the event parameter’s e.Data property to provide data for this data source. The data object should implement the IEnumerable or IListSource interface.

For other data source types (for instance, DashboardSqlDataSource or DashboardOlapDataSource), you can handle the DashboardDesigner.ConfigureDataConnection event to customize connection parameters.


Asynchronous Mode

The DashboardDesigner.AsyncDataLoading and DashboardDesigner.DataLoading events in asynchronous mode may occur multiple times while you design a dashboard and change the dashboard object model. To improve performance, do not call time-consuming methods in the event handler.


This example demonstrates how to use the DashboardDesigner.DataLoading event to load the data from XML file at runtime.

It 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 is obtained within the event handler and assigned to the e.Data property.

View Example: How to Load XML Data from a File at Runtime

using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
using DevExpress.XtraEditors;
using System;
using System.Data;

namespace Dashboard_DataLoading_Example {
    public partial class Form1 : XtraForm {

        string dataFileName = string.Empty;

        public Form1() {
            dashboardViewer1.CustomizeDashboardTitle += DashboardViewer1_CustomizeDashboardTitle;
            dashboardViewer1.Dashboard = new Dashboard1();
            dashboardViewer1.DataLoading += DashboardViewer1_DataLoading;

        private void DashboardViewer1_DataLoading(object sender, DataLoadingEventArgs e) {
            if (e.DataSourceName == "EnergyConsumptionBySector") {
                e.Data = GetData(dataFileName);

        public DataTable GetData(string fileName) {
            if (fileName == string.Empty) return null;
            DataSet xmlDataSet = new DataSet();
            return xmlDataSet.Tables["CountriesBySector"];

        private void DashboardViewer1_CustomizeDashboardTitle(object sender, CustomizeDashboardTitleEventArgs e) {
            DashboardToolbarItem titleButton = new DashboardToolbarItem("Load Data",
                new Action<DashboardToolbarItemClickEventArgs>((args) =>
            titleButton.Caption = "Load Data";
        private void LoadNewData() {
            dataFileName = @"..\..\Data\DashboardEnergyConsumptionBySector.xml";

The following code snippets (auto-collected from DevExpress Examples) contain references to the DataLoading event.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.


See Also