Geeks With Blogs
New Things I Learned January 2010 Entries
Make KeyedCollection<TKey, TItem> to work properly with WPF data binding
In my previous post, I went through creating the KeyedCollectionEx class which allows easier consumption of the KeyedCollection class (no need to derive anymore, just provide a delegate). One of the problem I encountered was that when using it as an ItemsSource in WPF, any changes to the collection will not be shown in the UI. This is because the class doesn’t implement INotifyCollectionChanged interface. So, let’s add that. The implementation is fairly straightforward; the class itself has all of ......

Posted On Tuesday, January 12, 2010 3:42 AM

Using KeyedCollection<TKey, TItem>
A little over 2 years ago, I saw my peer’s code that uses the KeyedCollection<TKey, TItem> class. I never seen it before, and it is actually a pretty nice class. It is essentially a dictionary class, but with the stipulation that the key for each item added to the dictionary can be retrieved from the item itself. With a Dictionary, every time we wanted to add a new item into it, we have to call its Add method, which accepts 2 parameters, the key for the item and the item itself. In most cases, ......

Posted On Thursday, January 7, 2010 10:42 AM

Copyright © Muljadi Budiman | Powered by: