I just migrated Dr. WPF's ObservableDictionary for WPF to silverlight. You can find the code here :
https://bitbucket.org/basarat/dictionarybasedvm/overview . Also at the same location is a sample.
The basic objective of making this is that you can Make a View Model properties to be exposed via a Dictionary rather than a Model. I would have preferred to work with dynamic but couldn't as described here : http://stackoverflow.com/q/5949826/390330 For change notification on bound string based indexer properties the dictionary needs to implement INotifyCollectionChanged. There is not dictionary on the framework that comes with this.
I will also be updating the project to try and implement IDataErrorInfo.
Application Screenshot :
Where the xaml is :
https://bitbucket.org/basarat/dictionarybasedvm/overview . Also at the same location is a sample.
The basic objective of making this is that you can Make a View Model properties to be exposed via a Dictionary rather than a Model. I would have preferred to work with dynamic but couldn't as described here : http://stackoverflow.com/q/5949826/390330 For change notification on bound string based indexer properties the dictionary needs to implement INotifyCollectionChanged. There is not dictionary on the framework that comes with this.
I will also be updating the project to try and implement IDataErrorInfo.
Application Screenshot :
Where the xaml is :
How about NGenerics ObservableashList for Silverlight may be you can add IDataErrorInfo here.
ReplyDeleteCan't believe I'm the first to comment here. Nice post!
ReplyDeleteI'm using this ObservableDictionary in my project
Thanks a lot for this.
ReplyDeleteBeing new to Silverlight and without a lot of experience in WPF I've spent the best part of this morning wondering what I was doing wrong, i.e. why was it working for an ObservableCollection but not for a dictionary. Should have consulted the oracle earlier.
Thanks
Did you ever get to implement IDataErrorInfo? I'm having a difficult time with it since my view model only has one property and it's the ObservableDictionary.
ReplyDeleteNo. Sorry.
ReplyDelete