Skip to main content

GridColumnSortInfoCollection.Add(GridColumn[], ColumnSortOrder[]) Method

Adds a new GridMergedColumnSortInfo item to the collection.

Namespace: DevExpress.XtraGrid.Columns

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

public GridMergedColumnSortInfo Add(
    GridColumn[] columns,
    ColumnSortOrder[] sortOrders
)

Parameters

Name Type Description
columns GridColumn[]

An array of GridColumn objects which will be sorted using the specified sort order. This parameter’s value is used to initialize the GridMergedColumnSortInfo.Columns property.

sortOrders ColumnSortOrder[]

An array of ColumnSortOrder values specifying the sort order for the columns. This parameter’s value is used to initialize the GridMergedColumnSortInfo.SortOrders property.

Returns

Type Description
DevExpress.XtraGrid.Columns.GridMergedColumnSortInfo

A GridMergedColumnSortInfo object representing the new element in the collection; null (Nothing in VB) if the object cannot be added to the collection.

Remarks

Adding an element to the collection automatically applies sorting by the corresponding column.

This method returns null (Nothing in VB) if the specified element cannot be added to the collection. This can occur for several reasons:

  • the grid’s View doesn’t support grouping and the specified column is being inserted as a grouping column (at a position less than the GridColumnSortInfoCollection.GroupCount);
  • the specified column doesn’t support sorting and therefore grouping is not supported (for instance, the columns which display image or memo data);
  • another element which refers to the specified column is already present in the current collection.

If the columns or sortOrders parameter equals null (Nothing in VB), the ArgumentNullException is thrown.

See Also