Wednesday, October 05, 2011

Development Tip – Dispatching calls to the UI thread

In Silverlight and WPF, if you wanted to update the UI from a thread you had launched, it was important that the UI update be executed on the UI thread, lest you get an invalid-cross-thread-access error.

You could ensure this by initially getting a pointer to the dispatcher for the UI thread, and then asking it to run your code. Something like this:

_OriginalDispatcher = Application.Current.RootVisual.Dispatcher;


Read more: Yet Another Coding Blog
QR: windows-8-development-tip-dispatching-calls-to-the-ui-thread.aspx

Posted via email from Jasper-Net