0
votes

I have an observable collection implemented in my user control which indicates states of a device. Based on the collection change, the user control is to trigger animations(subscribe to collectionchanged event). The observable collection is implemented as a dependency property. In the application, I data bind the device states to the user control observableCollection using one-way databinding. When a new state is added in the application, I can see the ObservableCollection in the user control is updated. However, the CollectionChanged event never got fired, so no animations. Does anyone has an idea why this is so?

Thank you in advance.

1
Code would be helpful, it's hard to know where exactly the mistake lies without any, there are many possibilities to mess bindings up. - H.B.
I am not sure how to post nice looking code here. so I uploaded a test project of what I did on hotfile.com. Hope this helps. hotfile.com/dl/95853235/ce366be/… - e0eight

1 Answers

0
votes

If the ObservableCollection is modified inside a thread other than your UI thread, things go wrong. Make sure that the thread that modifies your collection is the UI thread (use Dispatcher.Invoke if necessary) and see if this fixes the problem.