[Expand]General Information
[Collapse]WinForms Controls
 [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
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Collapse]Tree List
   [Expand]Product Information
   [Collapse]Feature Center
    [Expand]Data Binding
    [Expand]Data Editing
    [Expand]Data Presentation
    [Expand]Appearances and Look And Feel
    [Collapse]Focus, Selection and Navigation
      Focus and Navigation
      Node Selection
      Breadcrumb Navigation
      Node Checking - Checkboxes and Radio Buttons
      Scrollbar Annotations
     Formatting Cell Values
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End User Capabilities
   [Expand]Member Tables
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [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]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)

Node Selection

You can enable node selection, allowing multiple nodes to be selected. Selected nodes are highlighted in a specific manner, indicating their states. You can access these nodes in code and process them, if required.

Don't confuse selected nodes with the focused node. The focused node specifies the node containing focus. There is only one focused node. By default, in node selection mode, when a node is focused by an end-user, it's automatically selected. However, the end-user can click the focused node with the CTRL key pressed to deselect it. See Focus and Navigation to learn more.

Expanded Selected Nodes Overview

To enable node selection, set the TreeListOptionsSelection.MultiSelect property to true. In node selection mode, you or an end-user can select contiguous and non-contiguous node ranges.

Selected nodes are highlighted in a specific manner. You can use the TreeListAppearanceCollection.SelectedRow property to customize the appearance of selected nodes. The TreeListAppearanceCollection.HideSelectionRow property specifies the appearance of selected nodes, when the Tree List control is not focused.

If the TreeListOptionsBehavior.KeepSelectedOnClick option is active, the selection is preserved while editing cells within the selected nodes.

Expanded Selecting Nodes Using the Mouse and Keyboard

To select multiple nodes using the mouse, an end-user must use the SHIFT or CTRL key. To select a continuous range of nodes, click the first node of the range. Then, hold the SHIFT key down and click the last node of the range. To select a specific node (and add it to the existing selection), click it with the CTRL key pressed.

Clicking a node while holding the CTRL key down toggles the node's selected state, changing the state from selected to deselected, and vice-versa.

If the TreeListOptionsSelection.UseIndicatorForSelection property is enabled, the Node Indicator Panel can be used to select nodes. In this instance, an end-user can drag with the mouse along the indicator to select a range of nodes or click a specific node's indicator cell while holding down the CTRL key to toggle only this node's selection state.

For other methods of selecting nodes, see Selecting Nodes.

Expanded Work with Selection in Code

You can work with selection in code via the TreeList.Selection property. This property allows you to access the currently selected nodes and select or deselect certain nodes.

To respond to change in node selection, you can handle the TreeList.SelectionChanged event.

Expanded Example

The following code demonstrates how to traverse through selected nodes, in order to expand them. The selected nodes are accessed via the TreeList.Selection property.

Expanded Example

The following code shows how to select children of a specific node. In the example, nodes are selected via the TreeListMultiSelection.Set method of the TreeList.Selection object.

The image below shows the result of selecting a Sales and Marketing node's children.

Expanded Member Tables

Expanded End-User Capabilities

Expanded See Also

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