views:

285

answers:

2

I bound the ObservableCollection to the dataGrid itemssource.

the collectionChangedEvent of the observable Collection is getting called only when we add, delete, remove. But not firing when we update the record.

how to fire the event for Update too?

+2  A: 

The collection doesn't know when the record is modified. To get a notification when this happens, the record needs to implement INotifyPropertyChanged

Thomas Levesque
+1  A: 

If you want to be notified when an item is changed (ie you want to subscribe to this event), you are out of luck with ObservableCollection<T> because this collection only fires the CollectionChangedEvent.
Indeed, if you implement INotifyPropertyChanged, you will see changes to the items in the view (WPF does this automatically), but if you need to execute manual actions when an item changes, you can use BindingList<T>.

For exactly this scenario I rolled out a custom BindableCollection<T>, which implements ObservableCollection<T> and adds the OnItemChangedEvent. I can provide some sample code if necessary...

Roel