All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
The page you are viewing does not exist in version 20.2. This link will take you to the root page.
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

RowProperties.AllowSortOnClick Property

Gets or sets whether users can click the row header to sort data.

Namespace: DevExpress.XtraVerticalGrid.Rows

Assembly: DevExpress.XtraVerticalGrid.v21.1.dll

Declaration

[DefaultValue(DefaultBoolean.Default)]
[XtraSerializableProperty]
public DefaultBoolean AllowSortOnClick { get; set; }

Property Value

Type Default Description
DefaultBoolean

Default

False if users cannot click on the row header to sort data in the control; Default if this behavior depends on the control’s AllowSortOnClick option.

Available values:

Name Description
True

Corresponds to a Boolean value of true.

False

Corresponds to a Boolean value of false.

Default

The default behavior determined by the control’s logic.

Remarks

A user can sort data in the control from a row header’s context menu. Right-click a row header and select Sort Ascending or Sort Descending to sort values in the corresponding order. To make all rows display data in the same order as the data source, select Clear Sorting.

Vertical Grid Sorting

You can set the AllowSort property to false to disable this functionality.

Sort with a Click on a Row Header

You can enable the control’s AllowSortOnClick option to sort data when users click on a row header. Consecutive clicks change the sort order. Ctrl+Click clears the sort. If the AllowSort option is disabled, this property is not in effect.

If the control’s AllowSortOnClick option is enabled, you can use a row’s AllowSortOnClick property to disable this functionality for the row.

Sort in Code

Use a row’s SortOrder property to specify whether the row is sorted in ascending or descending order. If this property is set to None, data is not sorted. To make all rows display data in the same order as the data source, call the ClearSorting() method.

Sort by Multiple Rows

Data in the control can be sorted by multiple rows. For example, in a list of employees, you can first sort employees by surname and then by name. The resulting order of records depends on which list is sorted first. Users can hold Shift and click headers to sort by multiple rows.

A row’s SortIndex property specifies the index of the row in the collection of rows by which data is sorted. If you assign a non-negative value to this property, the control inserts the row to the collection of sorted rows at the specified position and sorts data in the row in ascending order.

When a user sorts data or you change a row’s SortOrder or SortIndex property value, the control raises the StartSorting event. When data is sorted, the EndSorting event fires.

Prevent Multiple Updates

Each time the sort order changes, the control reloads data from the data source. If you sort data by multiple rows, use the BeginSort() and EndSort() methods to prevent multiple updates. These methods suppress the StartSorting and EndSorting events.

Localize Context Menu Commands

You can use localizer objects to translate captions in the control. The VGridResLocalizer.GetLocalizedString method returns a caption for a specific user interface element. Override this method in a VGridResLocalizer descendant to change the caption.

You can also use satellite assemblies to localize the control. See the following topic for more information: Localization.

Example

The code below allows users to click a row header to sort data in all rows except the ID row.

vGridControl.OptionsBehavior.AllowSort = true;
vGridControl.OptionsBehavior.AllowSortOnClick = true;
erID.Properties.AllowSortOnClick = DefaultBoolean.False;
See Also