Can't find what you're looking for?

Contact us or post in our forums and we'll help you find an answer.

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)
Get the Latest Version of WinForms Edition
Download the Free Trial Now