[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Collapse]Grid View Data Layout
    [Expand]Columns and Card Fields
    [Expand]Rows and Cards
      Nodes Overview
      Iterating Through Nodes
      Expanding and Collapsing Nodes
      TreeListView Sorting Specifics
      Obtaining Nodes
      Checking Nodes
     Data Cells
     Best Fit
     Compact Mode
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Filtering and Searching
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus and Navigation
   [Expand]Conditional Formatting
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Expanding and Collapsing Nodes

Nodes with child nodes are called parent nodes. These nodes display expand buttons allowing end-users to show/hide their children. A node's expanded state is specified by the TreeListNodeBase.IsExpanded property.

Expanded Expanding Nodes

To expand a node, do one of the following.

Set the TreeListView.AutoExpandAllNodes property to true to expand all nodes automatically when the TreeListView is being loaded.

Before a node is expanded, the TreeListView.NodeExpanding event is raised. Handle this event to:

  • Cancel the action by setting the event parameter's TreeListNodeAllowEventArgs.Allow property to false;
  • Dynamically create child nodes. In this instance, when expanding a node, you do not know whether it has child nodes or not. If the node has no child nodes, hide the expand button by setting the TreeListNode.IsExpandButtonVisible property to false.

After a node has been expanded, the View fires the TreeListView.NodeExpanded event.

Example: How to: Dynamically Load Nodes

Expanded Collapsing Nodes

To collapse a node, do one of the following.

Before a node is collapsed, the TreeListView.NodeCollapsing event is raised. This allows you to cancel the action by setting the event parameter's TreeListNodeAllowEventArgs.Allow property to false.

After a node has been collapsed, the View fires the TreeListView.NodeCollapsed event.

Expanded Expand State

Use the following properties to bind the expand state of check boxes to a property:

Property Description
TreeListView.ExpandStateFieldName Gets or sets the name of the data field within the items source that determines which nodes are expanded.
TreeListView.ExpandStateBinding Gets or sets the binding that determines which nodes are expanded.

The TreeListView.ExpandStateBinding property takes precedence over the TreeListView.ExpandStateFieldName property.

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