Can I safely bind to data on multi-threaded applications?
- by Paul
Hi everyone,
I'm trying to solve a classic problem -
I have a multi-threaded application which runs some
processor-intensive calculations, with a GUI interface.
Every time one of the threads has completed a task, I'd like to
update a status on a table
taskID | status
I use DataGridView and BindingList in the following way:
BindingList<Task> tasks;
dataGridView.DataSource = tasks
public class Task : INotifyPropertyChanged
{
ID{get;}
Status{get;set;}
}
Can a background thread safely update a task's status?
and changes will be seen in the correct order in the GUI?
Second Question:
When do I need to call to PropertyChanged?
I tried running with and without the call, didn't seem to bother..
Third Question:
I've seen on MSDN that dataGridView uses BindingSource
as a mediator between DataGridView.DataSource and BindingList
Is this really necessary?