DashboardControl.SetInitialDashboardState Event
Allows you to specify the initial dashboard state when loading a dashboard.
Namespace: DevExpress.DashboardWpf
Assembly: DevExpress.Dashboard.v24.2.Wpf.dll
Declaration
Event Data
The SetInitialDashboardState event's data class is SetInitialDashboardStateWpfEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Dashboard | A dashboard whose state can be initialized. Inherited from SetInitialDashboardStateBaseEventArgs. |
InitialState | Gets or sets the dashboard initial state. Inherited from SetInitialDashboardStateBaseEventArgs. |
Remarks
This example demonstrates how to manage dashboard state to save and restore selected master filters values, current drill-down levels, and other parameters such as Treemap layers.
When the application starts, the DashboardControl loads the dashboard and the DashboardState object is deserialized and restored using the GetDataFromString method in the DashboardControl.SetInitialDashboardState event handler.
using DevExpress.DashboardCommon;
using System;
using System.Windows;
using System.Xml.Linq;
namespace WpfDashboard_DashboardState
{
public partial class MainWindow : Window
{
public static readonly string PropertyName = "DashboardState";
public MainWindow()
{
InitializeComponent();
}
DashboardState GetDataFromString(string customPropertyValue){
DashboardState dState = new DashboardState();
if(!string.IsNullOrEmpty(customPropertyValue)) {
var xmlStateEl = XDocument.Parse(customPropertyValue);
dState.LoadFromXml(xmlStateEl);
}
return dState;
}
private void dashboardControl_SetInitialDashboardState(object sender, DevExpress.DashboardWpf.SetInitialDashboardStateWpfEventArgs e){
var state = GetDataFromString(dashboardControl.Dashboard.CustomProperties.GetValue(PropertyName));
e.InitialState = state;
}
}
}
//...
For more information about a dashboard state, refer to the Manage Dashboard State document.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SetInitialDashboardState 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.