PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
BindingListExample with sorting on multiple properties
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
BindingListExample with sorting on multiple properties
![]() |
BindingListExample with sorting on multiple properties |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I needed to have support for sorting over multiple properties (i.e. in SQL
it would be SELECT * FROM TABLE ORDER BY X, Y, Z) within a BindingList. So I put together a sample BindingListExample that supports sorting, with direction, on multiple properties of data objects in the list. The IBindingList and the PropComparer implementation was based off of work by John Vottero, see reference. Essentially I hijack the IBindingList.ApplySort and ignore the PropertyDescriptor and ListSortDirection parameters in favor of pulling the parameters from a ListDictionary that contains the properties to be sorted on as keys, and the direction as the values. An expanded PropComparer, PropComparerList, cycles through the supplied ListDictionary until it reaches the end or the return value is not 0. Question, comments or suggestions can be sent to hollywood@thzero.com (or here). http://www.thzero.com/downloads/BindingListExample.zip References: http://www.google.com/groups?hl=en&...Bgroup:microsof t.public.dotnet.*%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D%2523 Tb%25239fJSCHA.3968%2540tkmsftngp12%26rnum%3D2 |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

