Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generic IBindingListView Implementations

Can anyone suggest a good implementation of a generic collection class that implements the IBindingListView & IBindingList interfaces and provides Filtering and Searching capabilities?

I see my current options as:

  • Using a class that someone else has written and tested
  • Inheriting from BindingList<T>, and implementing the IBindingListView interfaces
  • Write a custom collection from scratch, implementing IBindingListView and IBindingList.

Obviously, the first option is my preferred choice.

like image 689
Brad Leach Avatar asked Aug 26 '08 22:08

Brad Leach


3 Answers

I used and built upon an implementation I found on and old MSDN forum post from a few years ago, but recently I searched around again and found a sourceforge project called BindingListView. It looks pretty nice, I just haven't pulled it in to replace my hacked version yet.

nuget package: Equin.ApplicationFramework.BindingListView

Example code:

var lst = new List<DemoClass> {     new DemoClass { Prop1 = "a", Prop2 = "b", Prop3 = "c" },     new DemoClass { Prop1 = "a", Prop2 = "e", Prop3 = "f" },     new DemoClass { Prop1 = "b", Prop2 = "h", Prop3 = "i" },     new DemoClass { Prop1 = "b", Prop2 = "k", Prop3 = "l" } }; dataGridView1.DataSource = new BindingListView<DemoClass>(lst); // you can now sort by clicking the column headings  // // to filter the view... var view = (BindingListView<DemoClass>)dataGridView1.DataSource;             view.ApplyFilter(dc => dc.Prop1 == "a"); 
like image 136
Aaron Wagner Avatar answered Sep 28 '22 00:09

Aaron Wagner


Here is the help for your method 2 and 3 Behind the Scenes: Implementing Filtering for Windows Forms Data Binding

http://www.microsoft.com/downloads/details.aspx?FamilyID=4af0c96d-61d5-4645-8961-b423318541b4&displaylang=en

like image 44
Tun Avatar answered Sep 28 '22 02:09

Tun


A couple of solutions I can think of:

  1. The SubSonic Project has a pretty nice implementation of BindlingList<T> which is open source. Although this might require using the entire SubSonic binary to use their implementation.

  2. I enjoy using the classes from the Power Collections project. It is fairly simple to inherit from one of the base collections there and implement IBindingListView.

like image 39
Joseph Daigle Avatar answered Sep 28 '22 01:09

Joseph Daigle