Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sorting support using SortableBindingList

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Infralution Support Forum Index -> Virtual Tree FAQ
View previous topic :: View next topic  
Author Message
Infralution



Joined: 28 Feb 2005
Posts: 4753

PostPosted: Wed Jul 20, 2011 1:26 am    Post subject: Sorting support using SortableBindingList Reply with quote

If you bind Virtual Tree to a collection that supports the standard ITypedList interface then Virtual Tree can automatically implement sorting (so that when you click on a column header the tree is sorted via that column). The ITypedList interface is implemented by DataSets and Infralutions Virtual Data Objects collections - allowing you to get sorting support for these collections with no coding effort. But what if you just want to be able to sort a simple object list?

The Infralution.Common assembly defines a SortableBindingList<> class that implements the ITypedList interface for a simple object collection. So instead of using List<> or BindingList<> you would implement your collections using SortableBindingList<>.

There is one more step you need to take to get sorting working. For sorting to work Virtual Tree needs to bind to data via the ITypedList interface rather binding directly to the object properties via reflection. So instead of setting the TypeName property in the RowBinding, you must set the TypedListName property to the name of the TypedList. For SortableBindingList the TypedListName property just needs to be set to the simple class name of the contained objects.

For example if you had a list of the class "Part"

Code:
private SortableBindingList<Part> _parts = new SortableBindingList<Part>();


Then the TypedListName property should be set to "Part" and the TypeName property should be blank.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Infralution Support Forum Index -> Virtual Tree FAQ All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group