PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework BindingListExample with sorting on multiple properties

Reply

BindingListExample with sorting on multiple properties

 
Thread Tools Rate Thread
Old 01-08-2003, 06:45 PM   #1
Hollywood
Guest
 
Posts: n/a
Default BindingListExample with sorting on multiple properties


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


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off