Skip to main content
A newer version of this page is available. .

CustomColumnSortEventArgs Class

Provides data for the GridControl.CustomColumnSort event.

Namespace: DevExpress.Xpf.Grid

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

Declaration

public class CustomColumnSortEventArgs :
    EventArgs

Remarks

To learn more, see Sorting Modes and Custom Sorting.

Example

This example demonstrates how to implement custom sorting in the Grid Control. To do this, handle the GridControl.CustomColumnSort event, assign your custom sorted list to the e.Result property and set the e.Handled property to True.

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CustomSorting {
    public class SchedulerData {
        const int daysInWeek = 7;
        string[] employees = new string[] { "Jane", "Martin", "John", "Jack", "Amanda", "Carmen", "Wins", "Todd", "Ashley" };
        Random rnd = new Random();
        public List<SchedulerItem> Items { get; set; }
        public SchedulerData() {
            Items = new List<SchedulerItem>();
            GenerateRandomData();
        }
        void GenerateRandomData() {
            for (int i = 0; i < daysInWeek; i++) {
                int e1 = rnd.Next(employees.Length - 1);
                int e2 = e1 + 1;
                string day = DateTime.Today.AddDays(i).DayOfWeek.ToString();
                Items.Add(new SchedulerItem() { Day = day, Employee = employees[e1] });
                Items.Add(new SchedulerItem() { Day = day, Employee = employees[e2] });
            }
        }
    }

    public class SchedulerItem {
        public string Day { get; set; }
        public string Employee { get; set; }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomColumnSortEventArgs class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Inheritance

Object
EventArgs
CustomColumnSortEventArgs
See Also