views:

91

answers:

1

Hi, i want to use an event aggregator to syncronize my viewmodel with the view (the viewmodel ovservs the model), this is very simple to implement in the model, simply call notify on the setters of the properties.

but it gets more complicated when the model has collections. where should be the code which will call notify? what would be the interface of the collection in the model? IList?

the only solution that i've thought of is inhereting form a base class which will use reflection to iterate through all the IList fields, try to cast them to INotifyCollectionChanged and will add an event handler which will call notify.

any ideas?

Thanks in advance, Erik.

A: 

I would suggest using ObservableCollection rather than IList as the view will not get updated when the collection is added to or removed from.

Bermo