I have a WPF ListView that is bound to a collection (List<T>
). It is currently updated from the current thread which works ok.
I want to move the logic for updating the list into a thread and I see some potential issues regarding thread safety and the binding of the list. Can I be assured that the binding will not be updated unless I call NotifyPropertyChanged
? Is NotifyPropertyChanged
a blocking call or does it just add it to a message queue; in this instance surely there may be a condition where I tell the ListView
the collection updated, but by the time the binding updates I may be modifying the collection in the other thread which will throw an exception or crash the program.
What is the best method for implementing thread safety in such a scenario?