[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Collapse]Vertical Grid
   [Expand]Binding to Data
   [Collapse]Data Layout: Records, Rows and Cells
    [Collapse]Rows
      Focus and Scroll Rows
      Tree Traversal
      Expand and Collapse Rows
    [Expand]Records
    [Expand]Cells
     Customization Form
     Data Layout: Records, Rows, and Cells
   [Expand]Layouts
   [Expand]Data Editing and Validation
    Filtering
    Formatting Values
   [Expand]Drag and Drop
   [Expand]Appearance and Custom Painting
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Hit Information
    Batch Modifications
   [Expand]Member Tables
   [Expand]Examples
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Tree Traversal

This topic explains how to traverse vertical and property grid's Rows that are organized into a tree.

Expanded Enumerate All Rows

Follow the steps below to enumerate grid rows and perform a custom operation on each row.

  • Specify the operation performed on rows.

    • Inherit from the RowOperation abstract class. This class specifies an operation performed on rows.
    • Override the RowOperation.Execute method. This method is called each time a row is enumerated and accepts the row as a parameter.
  • Enumerate rows and perform the specified operation on each row.

Expanded Enumerate Specific Rows

You can also override the operation's following properties and methods:

Expanded How to: Count Rows

The following example shows how to count rows:

  • Implement a count operation.

  • Invoke the operation.

Expanded How to: Obtain Rows at Specific Level

This following example shows how to obtain a collection of rows at the specified level.

The code below prohibits users to resize rows at the first level.

Expanded How to: Collapse Specific Rows

The following example shows how to collapse all rows except for the specified row's parents.

The code below collapses all rows except for the focused row’s parents.

Is this topic helpful?​​​​​​​