Dispatcher.CheckAccess Method
Silverlight
Determines whether the calling thread is the thread associated with this Dispatcher.
Namespace: System.Windows.Threading
Assembly: System.Windows (in System.Windows.dll)
Return Value
Type: System.Booleantrue if the calling thread is the thread associated with this Dispatcher; otherwise, false.
The following code example demonstrates how to use this method.
private delegate void AddTextDelegate(Panel p, String text); private void AddText(Panel p, String text) { p.Children.Clear(); p.Children.Add(new TextBlock { Text = text }); } private void TestBeginInvokeWithParameters(Panel p) { if (p.Dispatcher.CheckAccess()) AddText(p, "Added directly."); else p.Dispatcher.BeginInvoke( new AddTextDelegate(AddText), p, "Added by Dispatcher."); }
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Dispatcher.CheckAccess not always visible in intellisense
When typing the Dispatcher.CheckAccess in a code window, the CheckAccess method on the Dispatcher may not always be visible in intellisense.
Type it anyway and let the compiler tell you there is an error(if there is one).
regards
GregJF
Type it anyway and let the compiler tell you there is an error(if there is one).
regards
GregJF
- 11/24/2010
- GregJF