views:

273

answers:

3

Hi,

I have a Datatable assigned to a DataGrid in main thread. I am updating the same DataTable from two different thread classes. Although the rows gets updated successfully in DataGrid control, I get following execption:

NotSupportedException thrown, with the message saying 'This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread.'

Any ideas on how do i update the DataTable in different thread?

Abdul khaliq

+1  A: 

You should read this article.

Am
A: 

from the thread you have your CollectionView in, use

this.Invoke(myUpdateMethod);

public void myUpdateMethod()
{

// get data from different thread and update collectionView

}
Tony
+1  A: 

Somewhat similar to this?

KMan