Skip to main content
A newer version of this page is available. .

DashboardLayoutGroup.FindRecursive(DashboardItemGroup) Method

Searches the layout tree recursively and returns the layout group for the specified dashboard item group.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v18.2.Core.dll

Declaration

public DashboardLayoutGroup FindRecursive(
    DashboardItemGroup itemGroup
)

Parameters

Name Type Description
itemGroup DashboardItemGroup

A DashboardItemGroup object that is the required dashboard item group.

Returns

Type Description
DashboardLayoutGroup

The DashboardLayoutGroup object that is the layout group for the specified dashboard item group. Returns null (Nothing in Visual Basic) if the required layout item is not found.

Remarks

Call the method for the Dashboard.LayoutRoot to find the layout group that corresponds to the specified dashboard item group.

Example

The following example demonstrates how to change a layout of the specified group in code.

In this example, the ASPxDashboardViewer loads an existing dashboard with the predefined layout from an XML file. The bottom group contains three dashboard items that are placed horizontally side-by-side.

The following steps are performed to customize a group layout:

Imports System
Imports DevExpress.DashboardWeb
Imports DevExpress.DataAccess.ConnectionParameters
Imports DevExpress.DashboardCommon

Namespace Dashboard_UpdateGroupLayout
    Partial Public Class WebForm1
        Inherits System.Web.UI.Page

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        End Sub

        Protected Sub ASPxDashboardViewer1_DashboardLoaded(ByVal sender As Object, _
                                           ByVal e As DashboardLoadedWebEventArgs)
            Dim dashboard As Dashboard = e.Dashboard
            Dim root As DashboardLayoutGroup = dashboard.LayoutRoot
            Dim bottomLayoutGroup As DashboardLayoutGroup = root.FindRecursive(e.Dashboard.Groups(1))

            Dim comboBox As DashboardItem = CType(dashboard.Items("comboBoxDashboardItem1"),  _
                ComboBoxDashboardItem)
            Dim listBox As DashboardItem = CType(dashboard.Items("listBoxDashboardItem1"),  _
                ListBoxDashboardItem)
            Dim chart As DashboardItem = CType(dashboard.Items("chartDashboardItem2"),  _
                ChartDashboardItem)

            Dim comboBoxLayoutItem As DashboardLayoutItem = root.FindRecursive(comboBox)
            comboBoxLayoutItem.Weight = 10
            Dim listBoxLayoutItem As DashboardLayoutItem = root.FindRecursive(listBox)
            listBoxLayoutItem.Weight = 90
            Dim chartLayoutItem As DashboardLayoutItem = root.FindRecursive(chart)
            chartLayoutItem.Weight = 76

            bottomLayoutGroup.ChildNodes.RemoveRange(comboBoxLayoutItem, _
                                                     listBoxLayoutItem, _
                                                     chartLayoutItem)
            Dim childGroup1 As New DashboardLayoutGroup(DashboardLayoutGroupOrientation.Vertical, 24, _
                                                        comboBoxLayoutItem, listBoxLayoutItem)
            bottomLayoutGroup.ChildNodes.AddRange(childGroup1, chartLayoutItem)
        End Sub

        Protected Sub ASPxDashboardViewer1_ConfigureDataConnection(ByVal sender As Object, _
                                           ByVal e As ConfigureDataConnectionWebEventArgs)
            If e.ConnectionName = "WebsiteStatisticsDataConnection" Then
                Dim parameters As XmlFileConnectionParameters = CType(e.ConnectionParameters,  _
                    XmlFileConnectionParameters)
                Dim databasePath As String = Server.MapPath("App_Data/WebsiteStatisticsData.xml")
                parameters.FileName = databasePath
            End If
        End Sub
    End Class
End Namespace

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FindRecursive(DashboardItemGroup) 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.

See Also