I have a WPF window in the main thread. On the clock buttons of this window, I upload data. In the meantime, I am using a separate thread to display the standby screen. But I can not set the main window as the parent of the standby screen. This causes the following error: The calling thread cannot access this object because another thread belongs to it
You want to learn the method Dispatcher.Invoke.
Dispatcher.Invoke
BackgroundWorker ; , . , .
BackgroundWorker
.
Dispatcher.Invoke :
private void DoStuffOnThread() { Dispatcher.Invoke(new Action(DoStuffOnUIThread)); } private void DoStuffOnUIThread() { // ... }
, , , / ( "" ), .
, , . , , Invoke.
WPF ( 4 ):
http://msdn.microsoft.com/en-us/magazine/cc163328.aspx