Skip to main content

DashboardControl.DashboardStateChanged Event

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

Namespace: DevExpress.DashboardWpf

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

NuGet Package: DevExpress.Wpf.Dashboard

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;  
} 

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DashboardStateChanged 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.

See Also