The requested page is not available for the requested platform. You are viewing the content for Default platform.

DashboardLayoutGroup.FindRecursive(DashboardItem) Method

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

Namespace: DevExpress.DashboardCommon

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


public DashboardLayoutItem FindRecursive(
    DashboardItem dashboardItem
Public Function FindRecursive(
    dashboardItem As DashboardItem
) As DashboardLayoutItem


Name Type Description
dashboardItem DashboardItem

A DashboardItem descendant that is the required dashboard item.


Type Description

The DashboardLayoutItem object representing a layout item that displays the required dashboard item. Returns null (Nothing in Visual Basic) if the required layout item is not found.


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


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"),  _
            Dim listBox As DashboardItem = CType(dashboard.Items("listBoxDashboardItem1"),  _
            Dim chart As DashboardItem = CType(dashboard.Items("chartDashboardItem2"),  _

            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, _
            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,  _
                Dim databasePath As String = Server.MapPath("App_Data/WebsiteStatisticsData.xml")
                parameters.FileName = databasePath
            End If
        End Sub
    End Class
End Namespace
See Also