I want to be able to sort a DataGridView by the ComboBoxColumn so I can display groups based on the value in the ComboBoxColumn. When I click the ComboBoxColumn, the DataGridView does not respond unlike the other columns which are TextBoxColumns. Meaning, it does not sort when I click the column header.
How can I provide this feature or do I have to override the functionality of the column with my own custom class?
I just prototyped this very quickly, by adding an unbound DataGridView to a form, then adding four columns, two textbox columns and two combobox columns.
The entire code-behind is shown below:
The sorting is working perfectly for me in this very simple example.
You may need to post code examples to narrow down what the difference is in your code.
One possible I can think of is that I’m binding to a list of strings, not objects.
According to the documentation you can also provide your own custom handler for the SortCompare event.