dashboard-devexpress-dot-dashboardwpf-dot-dashboardcontrol-37ccaa2e.md
Occurs after the DashboardControl loads a dashboard.
Namespace : DevExpress.DashboardWpf
Assembly : DevExpress.Dashboard.v25.2.Wpf.dll
NuGet Package : DevExpress.Wpf.Dashboard
public event DashboardLoadedEventHandler DashboardLoaded
Public Event DashboardLoaded As DashboardLoadedEventHandler
The DashboardLoaded event's data class is DashboardLoadedEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Dashboard | A dashboard to load. |
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.
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();
}
}
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
MinHeight="150"
DashboardLoaded="dashboardControl_DashboardLoaded"
ConfigureDataConnection="DashboardControl_ConfigureDataConnection"
#line 17 "..\..\..\MainWindow.xaml"
this.dashboardControl.DashboardLoaded += new DevExpress.DashboardWpf.DashboardLoadedEventHandler(this.dashboardControl_DashboardLoaded);
#ExternalSource("..\..\..\MainWindow.xaml",17)
AddHandler Me.dashboardControl.DashboardLoaded, New DevExpress.DashboardWpf.DashboardLoadedEventHandler(AddressOf Me.dashboardControl_DashboardLoaded)
See Also