DashboardDesigner.SetDashboardState(DashboardState) Method
Applies the dashboard state to the loaded dashboard.
Namespace: DevExpress.DashboardWin
Assembly: DevExpress.Dashboard.v20.2.Win.dll
NuGet Packages: DevExpress.Win.Dashboard, DevExpress.WindowsDesktop.Win.Dashboard
Declaration
Parameters
Name | Type | Description |
---|---|---|
state | DashboardState | A DashboardState object that contains the dashboard state information. |
Remarks
Refer to the Manage Dashboard State document for more information about a dashboard state.
The following code snippet applies the created dashboard state to the loaded dashboard at runtime:
//...
private void DashboardDesigner1_CustomizeDashboardTitle(object sender, CustomizeDashboardTitleEventArgs e){
DashboardToolbarItem resetStateItem = new DashboardToolbarItem("Reset State",
new Action<DashboardToolbarItemClickEventArgs>((args) =>
{
dashboardDesigner1.SetDashboardState(CreateDashboardState()); ;
}));
resetStateItem.Caption = "Reset Dashboard State";
e.Items.Add(resetStateItem);
}
public DashboardState CreateDashboardState(){
DashboardState state = new DashboardState();
// Set a range for a Range Filter.
state.Items.Add(new DashboardItemState("rangeFilterDashboardItem1")
{
RangeFilterState = new RangeFilterState(new RangeFilterSelection(new DateTime(2015, 1, 1), new DateTime(2017, 1, 1)))
});
// Specify master filter and drill-down values.
state.Items.Add(new DashboardItemState("gridDashboardItem1")
{
MasterFilterValues = new List<object[]>() { new object[] { "Gravad lax" }, new object[] { "Ikura" } },
DrillDownValues = new List<object>() { "Seafood" }
});
// Set a dashboard item layer.
state.Items.Add(new DashboardItemState("treemapDashboardItem1")
{
SelectedLayerIndex = 1
});
// Specify a default tab page.
state.Items.Add(new DashboardItemState("tabContainerDashboardItem1")
{
TabPageName = "dashboardTabPage2"
});
// Define a dashboard parameter value.
state.Parameters.Add(new DashboardParameterState()
{
Name = "ParameterCountry",
Value = "UK",
Type = typeof(string)
});
return state;
}
//...
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the SetDashboardState(DashboardState) method.
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.