Export (0) Print
Expand All
3 out of 6 rated this helpful - Rate this topic

Dispatcher.BeginInvoke Method (Action)

Silverlight

Executes the specified delegate asynchronously on the thread the Dispatcher is associated with.

Namespace:  System.Windows.Threading
Assembly:  System.Windows (in System.Windows.dll)
public DispatcherOperation BeginInvoke(
	Action a
)

Parameters

a
Type: System.Action
A delegate to a method that takes no arguments and does not return a value, which is pushed onto the Dispatcher event queue.

Return Value

Type: System.Windows.Threading.DispatcherOperation
An object, which is returned immediately after BeginInvoke is called, that represents the operation that has been posted to the Dispatcher queue.

The following code example demonstrates how to use this method.


private void TestBeginInvoke(Panel p)
{
    p.Dispatcher.BeginInvoke(() => {
        p.Children.Clear();
        p.Children.Add(
            new TextBlock { Text = "Added by Dispatcher." });
    });
}


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.