Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TreeViewControl.SortMode Property

Gets or sets how the TreeViewControl sorts its data. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v24.2.dll

NuGet Package: DevExpress.Wpf.Grid.Core

#Declaration

[DefaultValue(ColumnSortMode.Default)]
public ColumnSortMode SortMode { get; set; }

#Property Value

Type Default Description
ColumnSortMode Default

The sort mode.

Available values:

Name Description
Default

The actual sort mode is determined by a control. See the property description for more details.

Value

Sorts the column’s data by the column’s edit values (these are synchronized with the bound data source’s values).

DisplayText

Sorts the column’s data by the column’s display text (the strings displayed within the column’s cells).

Custom

Applies sort options specified in the CustomColumnSort event handler.

In data grids, this mode also applies group options from the CustomColumnGroup event handler.

#Remarks

The SortMode property specifies the algorithm used to sort TreeViewControl data (by display text, edit value, or a custom sorting algorithm).

The Default option is DisplayText if the TreeViewControl uses in-place editors inherited from the LookUpEditSettingsBase class (ComboBoxEditSettings, LookUpEditSettings). The Default option is Value in other cases.

Follow the steps below to apply custom logic to sort data:

  1. Set the SortOrder property to Ascending or Descending.
  2. Set the SortMode property to Custom.
  3. Handle the CustomNodeSort event.
See Also