[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [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
      TreeList Sorting Specifics
      Sorting at Runtime
      Sorting via Code
      Custom Sorting
    [Expand]Appearances and Look And Feel
    [Expand]Focus, Selection and Navigation
     Formatting Cell Values
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End User Capabilities
   [Expand]Member Tables
  [Expand]Gantt Control
  [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)

Sorting at Runtime

Expanded Sorting at Runtime

To sort data against a Tree List's column, or to change the column's sort order, an end-user can click its Column Header. The column's current sort order is indicated by the sort glyph (a small arrow displayed on the right edge of the column header). If the data is sorted in ascending order, the sort glyph represents an up-arrow. When sorting in descending order the sort glyph is displayed as a down-arrow. If the column isn't sorted, the sort glyph is hidden.

In the following image, data is sorted against the Department column in ascending order and against the Budget column in descending order.

If sorting isn't applied, clicking the column header sorts the data in ascending order by the column's contents. If sorting is already applied to the column, subsequent clicks reverse the current sort order. Note that a regular click on a column header clears the sort settings of any other columns. To preserve the existing sort settings of other columns, hold the SHIFT key down while clicking. This can be useful when you need to apply sorting to multiple columns at the same time. You can clear a column's sorting by clicking its header while holding the CTRL key down.

You can also apply sorting to columns via the Column Header Context Menu:

This availability of this menu is controlled by the Tree List's TreeListOptionsMenu.EnableColumnMenu property. You can also customize the menu's content as described in the Context Menus section.

Each column has an TreeListOptionsColumn.AllowSort property, which specifies whether an end-user can sort data against this column. The sort order, however, can always be changed in code.

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