Back to Devexpress

DashboardControl.DashboardLoaded Event

dashboard-devexpress-dot-dashboardwpf-dot-dashboardcontrol-37ccaa2e.md

latest6.1 KB
Original Source

DashboardControl.DashboardLoaded Event

Occurs after the DashboardControl loads a dashboard.

Namespace : DevExpress.DashboardWpf

Assembly : DevExpress.Dashboard.v25.2.Wpf.dll

NuGet Package : DevExpress.Wpf.Dashboard

Declaration

csharp
public event DashboardLoadedEventHandler DashboardLoaded
vb
Public Event DashboardLoaded As DashboardLoadedEventHandler

Event Data

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

PropertyDescription
DashboardA 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.

csharp
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();
    }
}
vb
Private Sub DashboardControl_DashboardLoaded(ByVal sender As Object, ByVal e As DevExpress.DashboardWpf.DashboardLoadedEventArgs)
    Dim excelDataSource = TryCast(e.Dashboard.DataSources.FindFirst(Function(i) i.ComponentName = "dashboardExcelDataSource1"), DashboardExcelDataSource)
    If excelDataSource IsNot Nothing Then
        excelDataSource.FileName = dashboardExcelDataFileName
        Dim worksheetSettings As New ExcelWorksheetSettings("Bike Data")
        excelDataSource.SourceOptions = New ExcelSourceOptions(worksheetSettings)
        excelDataSource.Fill()
    End If
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DashboardLoaded event.

Note

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.

wpf-dashboard-how-to-set-initial-dashboard-state/CS/WpfDashboard_DashboardState/MainWindow.xaml#L17

xml
MinHeight="150"
DashboardLoaded="dashboardControl_DashboardLoaded"
ConfigureDataConnection="DashboardControl_ConfigureDataConnection"

wpf-dashboard-how-to-set-initial-dashboard-state/CS/WpfDashboard_DashboardState/obj/Debug/net8.0-windows/MainWindow.g.cs#L95

csharp
#line 17 "..\..\..\MainWindow.xaml"
this.dashboardControl.DashboardLoaded += new DevExpress.DashboardWpf.DashboardLoadedEventHandler(this.dashboardControl_DashboardLoaded);

wpf-dashboard-how-to-set-initial-dashboard-state/VB/WpfDashboard_DashboardState/obj/Debug/net8.0-windows/MainWindow.g.vb#L95

vb
#ExternalSource("..\..\..\MainWindow.xaml",17)
AddHandler Me.dashboardControl.DashboardLoaded, New DevExpress.DashboardWpf.DashboardLoadedEventHandler(AddressOf Me.dashboardControl_DashboardLoaded)

See Also

DashboardControl Class

DashboardControl Members

DevExpress.DashboardWpf Namespace