DispatcherFrame Class
Represents an execution loop in the Dispatcher.
Assembly: WindowsBase (in WindowsBase.dll)
XMLNS for XAML: Not mapped to an xmlns.
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(); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); } public object ExitFrame(object f) { ((DispatcherFrame)f).Continue = false; return null; }
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.