Save a Dashboard
- 3 minutes to read
A dashboard provides the capability to save a dashboard definition (dashboard items, data source, data binding and layout settings, etc.) to an XML file or to a stream, and restore the dashboard from an XML file or a stream.
Save a Dashboard
Once a dashboard is designed, you can save its definition to the required data store. In the Dashboard Designer, this can be accomplished in the following ways.
You can save the dashboard definition by clicking the Save or Save As button in the File group on the Designer ribbon tab.
This invokes the Save As dialog, which allows you to locate the folder in which you wish to store your file.
You can handle the DashboardDesigner.DashboardSaving event to implement a custom saving procedure when an end-user clicks one of these buttons, or tries to save the dashboard using a save confirmation dialog.
Use the Dashboard.SaveToXml method to save the dashboard to an XML file or a stream.
The dashboard definition can be saved when the currently opened dashboard is closed (for instance, the window containing the DashboardDesigner is closed, a new dashboard is created or a different dashboard is opened). By default, a save confirmation dialog will be invoked.
Use the following methods and properties to manage dialog behavior.
Gets or sets the required action when the currently opened dashboard is being closed.
Handles the dashboard close process.
The DashboardDesigner.IsDashboardModified property indicates whether the dashboard has been modified since the last save.
You can handle the DashboardDesigner.DashboardClosing event to define the modification state of the dashboard according to your needs.
Load a Dashboard
A dashboard definition previously saved to an XML file or a stream can be loaded to the Dashboard Designer.
You can open the dashboard definition by clicking the Open button in the Ribbon menu of the Designer.
This invokes the Open File dialog, which allows you to locate the dashboard XML file.
You can handle the DashboardDesigner.DashboardOpening event to override the default Open File dialog and implement custom actions.
To load the dashboard in code, use the following members:
Loads a dashboard from an XML file.
Loads a dashboard from the specified XML file.
After the dashboard is opened, the DashboardDesigner.DashboardFileName property is initialized.
Load Dashboards using the Dashboard Viewer
Use the following members to load a dashboard definition with the Dashboard Viewer:
Loads a dashboard from a stream.
Gets or sets a dashboard supplier for the DashboardViewer.
To learn more, see Loading a Dashboard.