Skip to main content

DashboardLayoutGroup Class

A layout group used to arrange layout items or other groups within a dashboard.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v24.1.Core.dll

NuGet Package: DevExpress.Dashboard.Core


public class DashboardLayoutGroup :


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.


This example constructs the layout of a sample dashboard that contains the following items:

The Dashboard.LoadFromXml method loads a sample dashboard.

The following steps are taken to create a new layout:

  1. 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.
  2. 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.
  3. 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.
  4. Assign the root group to the Dashboard.LayoutRoot property.

View Example: How to modify dashboard layout in code

using System;
using System.Linq;
using DevExpress.XtraEditors;
using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
using System.IO;

namespace Dashboard_LayoutCustomization
    public partial class Form1 : XtraForm
        public Form1()
            dashboardViewer1.CustomizeDashboardTitle += DashboardViewer1_CustomizeDashboardTitle;

        private void ChangeLayout(DashboardToolbarItemClickEventArgs args)
            Dashboard dashboard = new Dashboard();
            // Switch off the DateFilter item's AutoHeight arrangement mode so that the DateFilter layout does not ignore its layout weight.
            ((DateFilterDashboardItem)(dashboard.Items["dateFilterDashboardItem1"])).ArrangementMode = DateFilterArrangementMode.Horizontal;
            // Hide captions.
            dashboard.Items.ForEach(item => item.ShowCaption = false);
            dashboard.Groups.ForEach(item => item.ShowCaption = false);
            // Create layout items for the DateFilter and Chart dashboard items.
            DashboardLayoutItem dateFilterLayoutItem = new DashboardLayoutItem(dashboard.Items["dateFilterDashboardItem1"], 13);
            DashboardLayoutItem chartLayoutItem = new DashboardLayoutItem(dashboard.Items["chartDashboardItem1"], 87);
            // Create a layout item for the dashboard Group item.
            DashboardLayoutGroup groupLayoutItem = new DashboardLayoutGroup()
                Orientation = DashboardLayoutGroupOrientation.Vertical,
                DashboardItem = dashboard.Groups["dashboardItemGroup1"],
                Weight = 70
            // Connect layout items in the layout tree.
            groupLayoutItem.ChildNodes.AddRange(dateFilterLayoutItem, chartLayoutItem);
            // Create a Grid layout item.
            DashboardLayoutItem gridLayoutItem = new DashboardLayoutItem(dashboard.Items["gridDashboardItem1"], 30);
            // Create a group layout item to organize the Grid layout item and a Dashboard Group layout item.
            DashboardLayoutGroup layoutGroup = new DashboardLayoutGroup(DashboardLayoutGroupOrientation.Horizontal, 85);
            // Connect layout items in the layout tree.
            layoutGroup.ChildNodes.AddRange(gridLayoutItem, groupLayoutItem);
            // Create a RangeFilter layout item.
            DashboardLayoutItem rangeFilterLayoutItem = new DashboardLayoutItem(dashboard.Items["rangeFilterDashboardItem1"], 15);            
            // Create a root layout group. Its DashboardItem property is null.
            DashboardLayoutGroup rootGroup = new DashboardLayoutGroup()
                Orientation = DashboardLayoutGroupOrientation.Vertical,
                Weight = 100,
                DashboardItem = null
            // Connect layout items in the layout tree. 
            rootGroup.ChildNodes.AddRange(layoutGroup, rangeFilterLayoutItem);
            // The layout treee is built. Set the dashboard's root layout node to finalize the layout.
            dashboard.LayoutRoot = rootGroup;

            dashboardViewer1.Dashboard = dashboard;

        private void RepositionItems(DashboardToolbarItemClickEventArgs args)
            Dashboard dashboard = dashboardViewer1.Dashboard;
            DashboardLayoutGroup rootGroup = dashboard.LayoutRoot.ChildNodes[0] as DashboardLayoutGroup;
            if ((rootGroup != null) && (rootGroup.ChildNodes.Count > 1))

        private void SaveLayoutToFile(DashboardToolbarItemClickEventArgs args)

        private void LoadLayoutFromFile(DashboardToolbarItemClickEventArgs obj)
            if (File.Exists("DashboardLayout.xml"))

        private void DashboardViewer1_CustomizeDashboardTitle(object sender, CustomizeDashboardTitleEventArgs e)
            var exportItem = e.Items.FirstOrDefault(i => i.ButtonType == DashboardButtonType.Export);
            if (exportItem != null)
            DashboardToolbarItem btnChangeLayout = new DashboardToolbarItem();
            btnChangeLayout.Caption = "Change Layout";
            btnChangeLayout.ClickAction = new Action<DashboardToolbarItemClickEventArgs>(ChangeLayout);
            DashboardToolbarItem btnRepositionItems = new DashboardToolbarItem();
            btnRepositionItems.Caption = "Reposition Items";
            btnRepositionItems.ClickAction = new Action<DashboardToolbarItemClickEventArgs>(RepositionItems);
            DashboardToolbarItem btnSaveLayout = new DashboardToolbarItem();
            btnSaveLayout.Caption = "Save Layout to File";
            btnSaveLayout.ClickAction = new Action<DashboardToolbarItemClickEventArgs>(SaveLayoutToFile);
            DashboardToolbarItem btnLoadLayout = new DashboardToolbarItem();
            btnLoadLayout.Caption = "Load Layout from File";
            btnLoadLayout.ClickAction = new Action<DashboardToolbarItemClickEventArgs>(LoadLayoutFromFile);
See Also