The following example demonstrates how to modify dashboard layout in code.
This example constructs the layout of a sample dashboard that contains the following items:
- DateFilterDashboardItem
- ChartDashboardItem
- DashboardItemGroup that contains the DateFilter and Chart items
- GridDashboardItem
- RangeFilterDashboardItem
The Dashboard.LoadFromXml method loads a sample dashboard.
The following steps are taken to create a new layout:
- Create DashboardLayoutItem objects to display the existing dashboard items and DashboardLayoutGroup object to display a dashboard group. The weight parameter specifies the layout item's relative size in a group.
- Create DashboardLayoutGroup objects to organize items which do not belong to a dashboard group item. Add layout items as child nodes to form a layout tree.
- Create a root group - a new DashboardLayoutGroup object whose DashboardLayoutGroup.DashboardItem property is null. Add the layout tree nodes to the root as its child nodes.
- Assign the root group to the Dashboard.LayoutRoot property.
This example also demonstrates how to use the DashboardLayoutNode.MoveRight method to swap layout items, save and restore the layout with the SaveDashboardLayout and LoadDashboardLayout methods.
(you will be redirected to DevExpress.com to submit your response)