views:

160

answers:

1

Basically I need to know whether I need to can Dispatcher.BeginInvoke or if it's not needed.

Thanks.

+6  A: 

You can use the Dispatcher.CheckAccess method. It returns true if you're on the same thread as the UI dispatcher, and false otherwise

Thomas Levesque
Is there any static entry point to get the Dispatcher? AFAIK I need a UI element to grab hold of the Dispatcher.
ruibm
There is a static entry point (`Dispatcher.CurrentDispatcher`), but it will return the dispatcher for the current thread, not the UI thread... If you want the UI thread, you can use `Application.Current.RootVisual.Dispatcher`
Thomas Levesque