Skip to main content Skip to footer

Sort tasks by multiple columns in C1GanttView

Background:

How to sort tasks by multiple columns in C1GanttView.

Steps to Complete:

This can be done easily by using the SortBy option from the ToolBar at runtime. However, here is the code snippet to sort tasks by multiple columns programmatically:

Dim properties As PropertyDescriptorCollection = TypeDescriptor.GetProperties(gv.Tasks(0))
Dim prop As PropertyDescriptor = properties.Find("Column1Name", False)
Dim prop1 As PropertyDescriptor = properties.Find("Column2Name", False)
Dim comparer As TaskComparer = New TaskComparer()
comparer.AddPropertyComparerInfo(prop, ListSortDirection.Ascending)
comparer.AddPropertyComparerInfo(prop1, ListSortDirection.Descending)
GanttView.SortTasks(comparer)

Prabhat Sharma