All docs
V21.1
21.1
20.2
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.

DashboardControl.DashboardStateChanged Event

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

Namespace: DevExpress.DashboardWpf

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

Declaration

public event DashboardStateChangedWpfEventHandler DashboardStateChanged

Event Data

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

Property Description
Dashboard A dashboard whose state can be initialized. Inherited from SetInitialDashboardStateBaseEventArgs.
DashboardState Gets the current state of the dashboard.
InitialState Gets or sets the dashboard initial state. Inherited from SetInitialDashboardStateBaseEventArgs.

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 DashboardControl.SetInitialDashboardState event to apply the state when a dashboard is loaded.

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

Example

This example demonstrates how to use the DashboardStateChanged event to display the result of user interactions. The DashboardState.Items property accesses the states of individual dashboard items. The TextEdit control displays the name of the Item and its filter values, current drill-down levels, and range-filter selections each time the dashboard state changes.

View Example: How to Use the DashboardStateChanged Event to Display User Interactions

using DevExpress.DashboardCommon;
using DevExpress.DashboardWpf;
using System;
using System.Linq;
using System.Windows;
// ...
 private void DashboardControl_DashboardStateChanged(object sender, DashboardStateChangedWpfEventArgs e) {
    var newState = e.DashboardState;
    var message = string.Empty;
    foreach(DashboardItemState itemState in newState.Items) {
        var item = dashboardControl1.Dashboard.Items[itemState.ItemName];
        message += item.Name;
        if( itemState.DrillDownValues.Count != 0) {
            message += "\n" + "Filter Drill-Down:" + " " + string.Join("," , itemState.DrillDownValues);
        }
        if(itemState.MasterFilterValues.Count != 0) {
            message +=  "\n" + "Master Filter:" + " " + string.Join(" | ", itemState.MasterFilterValues.Select(v=> string.Join(",",v))); 
        }
        if (itemState.RangeFilterState.Selection.Minimum !=null || itemState.RangeFilterState.Selection.Maximum != null) {
            message += "\n" + "Range Filter:" + " " + ((DateTime)itemState.RangeFilterState.Selection.Minimum).ToString("y") + "-" + ((DateTime)itemState.RangeFilterState.Selection.Maximum).ToString("y");
        }
        message += Environment.NewLine;
        message += "\n";
    }
          TextEdit.Text = message;  
} 
See Also