WPF Dispatcher.BeginInvoke child thread to update the UI

Original: WPF Dispatcher.BeginInvoke child thread to update the UI

When developing WPF applications appear: "The calling thread can not access this object because another thread has."

Because the UI thread is the main thread WPF application , if the child thread attempts to update the UI thread should be used Dispatcher.BeginInvoke () or Invoke () method.

Dispatcher.BeginInvoke () // executed asynchronously, without waiting for the end of the commission updated

The Dispatcher.Invoke ()           // on behalf of synchronous execution

Action ()                            // commissioned

the this .Dispatcher.BeginInvoke ( new new the Action (() => 
{ 
    // you update 
}));

Guess you like

Origin www.cnblogs.com/lonelyxmas/p/12160875.html