Golden Rule of Windows Multithreading

“Thou shalt only update UI using code that runs on the same thread as the UI.”

To obey the golden rule, the data needs to be shuttled back to the UI thread so we can update the element on the UI thread, rather than from some other thread.

In WPF, a quick, simple, and nice solution is to use the Dispatcher.

For the example, please refer to here

For the details of Dispatcher, please refer to MS official document.


~ by Martin on August 13, 2007.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: