All docs
V20.1
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

DashboardViewer.DashboardStateChanged Event

Occurs after the current dashboard state in the DashboardViewer is changed.

Namespace: DevExpress.DashboardWin

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

Declaration

public event DashboardStateChangedEventHandler DashboardStateChanged
Public Event DashboardStateChanged As DashboardStateChangedEventHandler

Event Data

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

Property Description
DashboardState Gets the current state of the dashboard.

Remarks

A dashboard state contains the selected master filter values, current drill-down levels, Range Filter and Date Filter settings, dashboard item layers and current parameter values. Use the DashboardStateChanged event to get the actual dashboard state - the latest interaction changes a user made to a dashboard. The DashboardState property provides access to the states of individual dashboard items displayed in the dashboard.

You can use the DashboardViewer.SetInitialDashboardState event to apply the state when a dashboard is loaded.

For more information about a dashboard state, see Manage Dashboard State.

Examples

The following code snippet demonstrates how to save a dashboard state each time it is changed.

The DashboardViewer.GetDashboardState method obtains a dashboard's state object in the DashboardStateChanged event that is handled each time the dashboard state is changed. The state is serialized to XML and added to the XElement object stored in the CustomProperties collection.

The dashboard state is restored in the DashboardViewer.SetInitialDashboardState event handler.

using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
// ...
DashboardState state = new DashboardState();
const string path = @"..\..\Dashboards\dashboard1.xml";
// ... 
private void DashboardViewer_DashboardStateChanged(object sender, DashboardStateChangedEventArgs e) {
  state = dashboardViewer.GetDashboardState();
  var stateValue = state.SaveToXml().ToString(SaveOptions.DisableFormatting);
  dashboardViewer.Dashboard.CustomProperties.SetValue("DashboardState", stateValue);          
}

private void DashboardViewer_SetInitialDashboardState(object sender, SetInitialDashboardStateEventArgs e) {
  e.InitialState = state;
}
// ...  
See Also