This documentation is archived and is not being maintained.

DispatcherFrame Class

Represents an execution loop in the Dispatcher.

Namespace:  System.Windows.Threading
Assembly:  WindowsBase (in WindowsBase.dll)
XMLNS for XAML: Not mapped to an xmlns.

public class DispatcherFrame : DispatcherObject
You cannot use this managed class in XAML.

DispatcherFrame objects typically fall into two categories:

  • Long running, general purpose frames that exit only when instructed to. These frames should exit when they are requested.

  • Short running, very specific frames that exit when an important criteria is met. These frames may consider not to exit when they are requested in favor of waiting for their exit criteria to be met. These frames should have a time-out associated with them.

The following example shows how to use a DispatcherFrame to achieve similar results as the Windows Forms DoEvents method.

[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public void DoEvents()
    DispatcherFrame frame = new DispatcherFrame();
        new DispatcherOperationCallback(ExitFrame), frame);

public object ExitFrame(object f)
    ((DispatcherFrame)f).Continue = false;

    return null;


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0