IList implementation as data source for DataGridView

M

Marc Gravell

For completeness, I should highlight that another approach is to
simply subclass BindingList<T>, and override or add a few methods.
This isn't always suitable, but sometimes it is... saves a lot of code
like the above! I've done this to implement multi-column sorting and
filtering, for example (IBindingListView).

Marc
 
T

t.mills624

OK; here is a pretty-bare-bonesimplementationthat supports change
notification of items via INotifyPropertyChanged...

I haven't quite gotten to work, I'm guessing it's because of several
things: this isn't your full version, I'm actually implementing IList,
etc..

So I'm mix and matching derivatives and implementations to see what
happens; thanks for the assistance.
 
T

t.mills624

I haven't quite gotten to work, I'm guessing it's because of several
things: this isn't your full version, I'm actually implementing IList,
etc..

So I'm mix and matching derivatives and implementations to see what
happens; thanks for the assistance.

From what I've gathered from the debugger, it appears that, in the
above code example, when Button2 "Insert" is clicked, it calls
data.Insert(), which in turn raises OnListChanged, which then notifies
the DGV that a new item is being added, and so the DGV then calls
IBindingList.AddNew, which also raises OnListChanged, and it's on this
2nd OnListChanged that an exception is thrown.

I just added this note in case anyone else was trying to use the code
as a base to start from; like I mentioned in my previous post, there
are probably some pieces that were left out, in good intention, to
just address the particular issue of the WatchForChange function as
the means to mimic the native event handling of the BindingList<T>
object.

I'm just going to give in and use BindingList<T>.

Plus WPF, LINQ, and .Net 3 are probably going to obsolete this whole
approach anyway. It's so perfect how Microsoft releases platform
versions; .NET 10 probably exists right now, but they'll only release
it in increments to ensure that you pay top dollar to keep feeding
from their hands.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top