The requested page is not available for the requested platform. You are viewing the content for Default platform.
All docs
19.2 (EAP/Beta)
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

DashboardViewer.SetInitialDashboardState Event

Allows you to specify the initial dashboard state when loading a dashboard.

Namespace: DevExpress.DashboardWin

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


public event SetInitialDashboardStateEventHandler SetInitialDashboardState
Public Event SetInitialDashboardState As SetInitialDashboardStateEventHandler

Event Data

The SetInitialDashboardState event handler receives an argument of the SetInitialDashboardStateEventArgs type. The following properties provide information specific to this event.

Property Description
Dashboard A dashboard whose state can be initialized.
InitialState Gets or sets the dashboard initial state.


Refer to the Manage Dashboard State document for more information about a dashboard state.



The complete sample project How to Set the Initial Dashboard State in the WinForms Viewer is available in the DevExpress Examples repository.

The following code snippet shows how to save and restore a dashboard state for WinForms Dashboard Viewer:

using DevExpress.DashboardCommon;
using DevExpress.XtraEditors;
using System;
using System.Windows.Forms;
using System.Xml.Linq;

namespace WinFormsViewerSaveAndApplyDashboardState
    public partial class ViewerForm1: XtraForm
        DashboardState dState = new DashboardState();
        const string path = @"..\..\Dashboards\dashboardWithSavedState.xml";
        public ViewerForm1() {
            dashboardViewer.DashboardLoaded += dashboardViewer_DashboardLoaded;
            dashboardViewer.SetInitialDashboardState += dashboardViewer_SetInitialDashboardState;
            dashboardViewer.DashboardSource = path;

        private void dashboardViewer_DashboardLoaded(object sender,
            DevExpress.DashboardWin.DashboardLoadedEventArgs e) {
            XElement data = e.Dashboard.UserData;
                if(data != null) {
                    if(data.Element("DashboardState") != null) {
                        XDocument dStateDocument = XDocument.Parse(data.Element("DashboardState").Value);

        private void dashboardViewer_SetInitialDashboardState(object sender,
            DevExpress.DashboardWin.SetInitialDashboardStateEventArgs e) {
            e.InitialState = dState;

        private void ViewerForm1_FormClosing(object sender,FormClosingEventArgs e) {
            dState = dashboardViewer.GetDashboardState();
            XElement userData = new XElement("Root",
                new XElement("DateModified",DateTime.Now),
                new XElement("DashboardState",dState.SaveToXml().ToString(SaveOptions.DisableFormatting)));
            dashboardViewer.Dashboard.UserData = userData;
See Also