Я использую BindingList<T>
в своих Windows Forms, который содержит список контактных объектов IComparable<Contact>
. Теперь я хочу, чтобы пользователь мог сортировать по любому столбцу, отображаемому в сетке.
Существует способ, описанный в MSDN в Интернете, который показывает, как реализовать пользовательскую коллекцию на основе BindingList<T>
, которая позволяет сортировать. Но не существует ли Сорт-событие или что-то, что можно было бы поймать в DataGridView (или, что еще лучше, на BindingSource), чтобы отсортировать базовую коллекцию с помощью пользовательского кода?
Мне не очень нравится способ, описанный MSDN. Другим способом я мог легко применить запрос LINQ к коллекции.