INotifyCollectionChanged & ObservableCollect<T>

INotifyCollectionChanged & ObservableCollect<T>

Old forum URL: forums.lhotka.net/forums/t/3506.aspx


FireGarden posted on Monday, September 10, 2007

How do INotifyCollectionChanged & ObservableCollect<T> affect Csla 3.5?

Thanks,

Rob

RockfordLhotka replied on Monday, September 10, 2007

INotifyCollectionChanged is an interesting interface, which was introduced in .NET 3.0. It makes sense, but it also is not necessary given that we already had IBindingList.

And that's what makes it interesting. Windows Forms uses IBindingList, and doesn't know about INotifyCollectionChanged. So if you want to work with Windows Forms, you must use IBindingList, not INotifyCollectionChanged.

WPF on the other hand, knows about both interfaces. So if you want to work with the broadest set of technologies you'd opt for IBindingList, but if you only want to work with WPF then you'd opt for INotifyCollectionChanged.

In 3.0.0 I implemented both interfaces. That was a mistake, because WPF honors both - resulting in duplicate event processing and lists getting messed up in the display. So in 3.0.1 I reverted to IBindingList, because CSLA supports all current UI technologies.

.NET 3.5 won't change this dynamic, because (to my knowledge) they still aren't changing Windows Forms to honor the new interface. Therefore CSLA must continue to use IBindingList.

But that's OK - it isn't like INotifyCollectionChanged offers any advantage over IBindingList. So CSLA doesn't lose anything by supporting the older (and richer) interface. Rather it gains a great deal by sticking with the more broadly used interface.

Copyright (c) Marimer LLC