T
T
trauus2016-01-29 20:46:57
C++ / C#
trauus, 2016-01-29 20:46:57

DataGridView: how to make friends with multithreading?

C# application, UI on WinForms. There is a List in which objects are added and removed from different threads, their properties change. There is also a DataGridView on which these objects should be displayed and updated in real time. BindingList is not suitable, PropertyChanged events come from different threads.
As I imagine, you need to write a proxy class that will intercept the PropertyChanged and CollectionChanged events from the collection, marshal them to the UI thread, and then everything will work as it should.
Are there other ways to get it to work properly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peter, 2016-01-29
@petermzg

So update the data in the main thread and events will come from it. Sense to update the data in different?
There is a synchronization context and use it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question