Requests cancellation of a pending background operation.
Assembly: System (in System.dll)
The method submits a request to stop the background operation and sets the CancellationPending property to true.
When you call , your background operation will be able to stop and exit. The operation code should periodically check the CancellationPending property to see whether it has been set to true.
Be aware that your code in the DoWork event handler may complete its work as a cancellation request is being made, and your polling loop may miss CancellationPending being set to true. In this case, the Cancelled flag of System.ComponentModel.RunWorkerCompletedEventArgs in your RunWorkerCompleted event handler will not be set to true, even though a cancellation request was made. This situation is called a race condition and is a common concern in multithreaded programming. For more information about multithreading design issues, see Best Practices for Managed Threading.
The following code example demonstrates the use of the method to cancel a background operation. To view the complete code for this sample, see How to: Use a Background Worker.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.