views:

104

answers:

1

Gosh! I hate this. Why it is so complicated?

What I'm trying to do:

I have a form with several UserControls each with a DataGrid. Each grid bind with ObservableCollection through .ItemSource property, everytime when program catches an event, it makes changes in one of the implied collections. But a picture of a grid doesn't update.

+7  A: 

ObservableCollection will not notify the control if a property of the element has changed - unless the element specifically notifies the subscribers through INotifyPropertyChanged.

Why it works this way? A collection is just a container, and while it knows about the number of the elements and when element was added or removed, it does not know "what is inside" of an element and what properties should raise notifications. Even when you implement the INotifyPropertyChanged yourself, you would need to decide changing of which properties should raise the event.

Sergey Aldoukhov
Seconded, You have to make sure that the elements in your collection implementINotifyPropertyChanged
Jason Watts
Thirded :)Plotnick - I know WPF DataBinding is daunting at first, but stick with it... it's actually a fantastic model and it makes a ton of sense once you get through the learning curve which, to be sure, is steep.
Mark