Click here to Skip to main content
15,922,007 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I'm working on a WPF project and I'm having an issue with binding an ObservableCollection within an ObservableCollection to an ItemsControl.

I have an ObservableCollection of business objects ("Register") and within the "Register" object I have another ObservableCollection containing another business object ("RegisterParameter"). The first layer of Binding works correctly, but the second layer (the RegisterParameter's) does not update the UI when a change is made. The initial value is always correct.

How can I get the UI to update when the ObservableCollection inside the ObservableCollection updates?

(Both business objects implement INotifyPropertyChanged)

Thanks!
Posted
Comments
Kenneth Haugland 7-Aug-12 11:29am    
Lets see the code then.... Remember that the collection have to change (add/remove items) for the observable collection to fire an event.,
Kenneth Haugland 7-Aug-12 11:54am    
And I dont think this can be done as you propose.... You'll have to redesign it...

1 solution

A quick search on Google[^] lead to the same conclution regarding observable collections.

The issue could be resolved by using other list though:
http://social.msdn.microsoft.com/Forums/en/wpf/thread/c5db68a6-5eb7-4f16-8a1c-ccae2ac465a4[^]
 
Share this answer
 
v2
Comments
Adam7869 7-Aug-12 14:10pm    
Hi Kenneth,

Your link helped me get the parent UI binding to update when the child was changed. It doesn't cover updating the child UI when the parent is updated. Any advice on that?
Kenneth Haugland 7-Aug-12 14:19pm    
This is going to be pretty bad code, but it can be achived by resetting or calling INotifychange on all your properties.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900