views:

29

answers:

1

When I bind a BindingList<ProcessDataItem> to a ComboBox an InvalidOperationException is thrown saying, that the collection that is enumerated changed. Instances of ProcessDataItem permanently receive updates when their corresponding measurement value has changed. The class implements INotifyPropertyChanged to notify its container of those changes. This seems to cause the problem. I'm surprised to have this issue since the collection remains untouched. Nothing is added or removed. Only values change. How can I fix this?

Edit: The documentation of the BindingList.ListChanged event says:

Occurs when the list or an item in the list changes.

This seems to cause my problem. Will I have to create an own container class that suppresses value change events while an enumeration is in progress?

A: 

I finally had to solve the synchronization issue in the ProcessDataItem class and not on container level. Now the BindingList.ListChanged event is called form the GUI thread. KeeperOfTheSoul was absolutely right with his comment.

h0b0