can somebody help me? I am trying to do custom sort of items in objectlistview. I have found a method using BeforeSorting event. Items are sorted, but objectlistview are showing "old data". The source of items for objectlistview is _shows.
private void objectListView1_BeforeSorting(object sender, BeforeSortingEventArgs e)
{
_shows.OrderByDescending(s => s.Name != "News").ThenBy(s => s.Name);
e.Handled = true;
}
Thank you!!
You are not using the returned sorted collection, it should be:
_shows =
_shows.OrderByDescending(s => s.Name != "News").ThenBy(s => s.Name);
This will result in IOrderedCollection
, in case _shows
is a List
, then to ToList()
post ThenBy
Post this I assume that you rebind the Datagridview with the data source _shows
and thus the correct values will be reflected