DashboardLayoutGroup Class
A layout group used to arrange layout items or other groups within a dashboard.
Namespace: DevExpress.DashboardCommon
Assembly: DevExpress.Dashboard.v18.2.Core.dll
Declaration
Related API Members
The following members return DashboardLayoutGroup objects:
Remarks
The DashboardLayoutGroup class exposes the DashboardLayoutGroup.ChildNodes property that provides access to the collection of child layout groups and items that constitute the current layout group. Use the DashboardLayoutGroup.Orientation property to specify the orientation of layout items/groups within the group.
The DashboardLayoutGroup.Weight property allows specifying the relative size of the layout group.
Example
The following example demonstrates how to modify dashboard layout in code.
In this example, the DashboardViewer loads a dashboard containing three dashboard items placed vertically, one above the other. The following steps are taken to create a new layout:
- Three DashboardLayoutItem objects are created to display the existing dashboard items. The weight parameter specifies the layout item’s relative size.
- A new
DashboardLayoutGroup
is created to display two dashboard items. The Orientation parameter specifies how layout items are placed within the group. - A root layout group is created. This group contains the previously created group and another layout item.
- The root layout group is assigned to the LayoutRoot property.
This example also demonstrates how to swap layout items using the MoveRight(DashboardLayoutNode) method, save and restore the layout using the SaveDashboardLayout(String) and LoadDashboardLayout(String) methods.
Note
The complete sample project How to modify dashboard layout in code is available in the DevExpress Examples repository.
using System;
using DevExpress.XtraEditors;
using DevExpress.DashboardCommon;
namespace Dashboard_LayoutCustomization {
public partial class Form1 : XtraForm {
public Form1() {
InitializeComponent();
dashboardViewer1.LoadDashboard(@"..\..\Data\Dashboard.xml");
}
private void btnUpdateLayout_Click(object sender, EventArgs e) {
Dashboard dashboard = new Dashboard();
dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml");
DashboardItem grid = (GridDashboardItem)dashboard.Items[0];
DashboardItem chart = (ChartDashboardItem)dashboard.Items[1];
DashboardItem range = (RangeFilterDashboardItem)dashboard.Items[2];
// Creates layout items used to display dashboard items.
DashboardLayoutItem gridItem = new DashboardLayoutItem(grid, 35);
DashboardLayoutItem chartItem = new DashboardLayoutItem(chart, 65);
DashboardLayoutItem rangeItem = new DashboardLayoutItem(range, 20);
// Creates a layout group that contains two layout items.
DashboardLayoutGroup group1 =
new DashboardLayoutGroup(DashboardLayoutGroupOrientation.Horizontal, 80,
gridItem, chartItem);
// Creates a root layout group that contains the previously created group and
// the layout item displaying the Range Filter dashboard item.
DashboardLayoutGroup rootGroup =
new DashboardLayoutGroup(DashboardLayoutGroupOrientation.Vertical, 1,
group1, rangeItem);
// Specifies the root dashboard layout group.
dashboard.LayoutRoot = rootGroup;
dashboardViewer1.Dashboard = dashboard;
}
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DashboardLayoutGroup class.
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.