This project is read-only.

Reflect property changes in index for classes that support INotifyChanging and INotifyChanged


I greatly like this library, but to be able to use it in one of my projects, I need support for propertychanges to items in the IndexableCollection. Ideal would be to automatically update indexed properties of classes that implement INotifyPropertyChanged and INotifyPropertyChanging.
I'll try to submit a patch which implements just that.


wrote Apr 25, 2009 at 10:35 PM

Resolved with changeset 33509.

staxmanade wrote Apr 25, 2009 at 10:38 PM

Thanks for the patch...

I've created a branch, checked in your changes (to the branch), and added one test and fix for the case when a raised property changed event throws a bad property name.

I would like to spend some more time thinking about this change and other side affects it may cause. (performance, etc) before it is merged in, however this is one of the big ticket items Aaron and I both feel the library should support.

Thanks again,
Jason (Staxmanade)

wrote Apr 25, 2009 at 10:52 PM

wrote Apr 25, 2009 at 10:52 PM

Lashas wrote Aug 7, 2009 at 12:12 AM

I have optimizied a littile bit (adding item to list is ~30-40% faster) by changing how handlers are attached to item. Instead of
(item as INotifyPropertyChanged).PropertyChanged += IndexableCollection_PropertyChanged;
I've changed to
(item as INotifyPropertyChanged).PropertyChanged += _propertyChangedHandler;
while _propertyChangedHandler is private field in IndexableCollection, and is initialized in constructor by this line "
_propertyChangedHandler = new PropertyChangedEventHandler(IndexableCollection_PropertyChanged);"

Finally this left me with same performance as object would be without INotifyPropertyChanged interface.

wrote Aug 7, 2009 at 6:45 AM

Test comment from V.S. /tfs since I can't hit the codeplex website.

wrote Aug 7, 2009 at 6:52 AM

Great suggestion. It's funny how I didn't notice that. By using the C# syntactic sugar (where we don't specify "prop += new EventHandler(Handler)" and instead use "prop += Handler") I didn't even think about it haveing to create a new object for each pass...
Thanks for the contribution.

wrote Feb 14, 2011 at 5:14 PM

wrote Feb 14, 2013 at 3:52 AM

wrote Dec 9 at 10:14 PM