DispatcherPriority DispatcherPriority DispatcherPriority DispatcherPriority Enum

Definition

Describes the priorities at which operations can be invoked by way of the Dispatcher.

public enum class DispatcherPriority
public enum DispatcherPriority
type DispatcherPriority = 
Public Enum DispatcherPriority
Inheritance
DispatcherPriorityDispatcherPriorityDispatcherPriorityDispatcherPriority

Fields

ApplicationIdle ApplicationIdle ApplicationIdle ApplicationIdle 2

The enumeration value is 2. Operations are processed when the application is idle.

Background Background Background Background 4

The enumeration value is 4. Operations are processed after all other non-idle operations are completed.

ContextIdle ContextIdle ContextIdle ContextIdle 3

The enumeration value is 3. Operations are processed after background operations have completed.

DataBind DataBind DataBind DataBind 8

The enumeration value is 8. Operations are processed at the same priority as data binding.

Inactive Inactive Inactive Inactive 0

The enumeration value is 0. Operations are not processed.

Input Input Input Input 5

The enumeration value is 5. Operations are processed at the same priority as input.

Invalid Invalid Invalid Invalid -1

The enumeration value is -1. This is an invalid priority.

Loaded Loaded Loaded Loaded 6

The enumeration value is 6. Operations are processed when layout and render has finished but just before items at input priority are serviced. Specifically this is used when raising the Loaded event.

Normal Normal Normal Normal 9

The enumeration value is 9. Operations are processed at normal priority. This is the typical application priority.

Render Render Render Render 7

The enumeration value is 7. Operations processed at the same priority as rendering.

Send Send Send Send 10

The enumeration value is 10. Operations are processed before other asynchronous operations. This is the highest priority.

SystemIdle SystemIdle SystemIdle SystemIdle 1

The enumeration value is 1. Operations are processed when the system is idle.

Examples

The following example is a call to BeginInvoke that passes a delegate which accepts an argument. The priority is set to Normal.

// Schedule the update function in the UI thread.
tomorrowsWeather.Dispatcher.BeginInvoke(
    System.Windows.Threading.DispatcherPriority.Normal,
    new OneArgDelegate(UpdateUserInterface), 
    weather);
' Schedule the update function in the UI thread.
tomorrowsWeather.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, New OneArgDelegate(AddressOf UpdateUserInterface), weather)

Remarks

There is no specific system state or "idleness" corresponding to ApplicationIdle and ContextIdle in the current version of WPF. Both are still valid priorities; therefore, an operation with a priority of ContextIdle has a higher priority than an operation with a priority of SystemIdle.

The ApplicationIdle does not throttle the execution of an operation if it exceeds a certain percentage of the CPU. One way to throttle a process it to use a timer.

If an operation is posted using Invoke on its own ContextIdle at a priority of Send, the operation bypasses the queue and is immediately executed.

Applies to