DashboardControl.DashboardLoaded Event

Occurs after the DashboardControl loads a dashboard.

Namespace: DevExpress.DashboardWpf

Assembly: DevExpress.Dashboard.v21.1.Wpf.dll

Declaration

public event DashboardLoadedEventHandler DashboardLoaded

Event Data

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

Property Description
Dashboard A dashboard to load.

Remarks

The DashboardLoaded event is raised when the DashboardControl loads a dashboard from XML definition file. It happens when calling the DashboardControl.LoadDashboard method or assigning the file path or resource pack URI to the DashboardControl.DashboardSource property.

The event occurs after the Dashboard object is created and before it is assigned to the DashboardControl.Dashboard property.

NOTE

This event does not occur when a dashboard object model or dashboard class instance is assigned using the DashboardControl.Dashboard or DashboardControl.DashboardSourceproperty in XAML or in code.

Use the DashboardLoadedEventArgs.Dashboard event parameter to modify the dashboard before the DashboardControl displays it.

Handle this event to change the data source for the loaded dashboard, as illustrated in the following code snippet.

View Example: How to Change the Dashboard Data Source Using the DashboardLoaded Event

 private void DashboardControl_DashboardLoaded(object sender, DevExpress.DashboardWpf.DashboardLoadedEventArgs e)
{
    var excelDataSource = e.Dashboard.DataSources.
      FindFirst(i => i.ComponentName == "dashboardExcelDataSource1") as DashboardExcelDataSource;
    if (excelDataSource != null)
    {
        excelDataSource.FileName = dashboardExcelDataFileName;
        ExcelWorksheetSettings worksheetSettings = new ExcelWorksheetSettings("Bike Data");
        excelDataSource.SourceOptions = new ExcelSourceOptions(worksheetSettings);
        excelDataSource.Fill();
    }
}
See Also