Syncfusion WPF FAQ
Questions and answers in this FAQ have been collected from newsgroup posts, various mailing lists and the employees of Syncfusion.

6. Concepts Threading

FAQ Home
   6.1 What is the equivalent of the Windows Forms OnIdle event in WPF?



6.1 What is the equivalent of the Windows Forms OnIdle event in WPF?


In WPF, you can set something to be run on application idle or system idle using the Dispatcher instance of the UI thread as follows:

[C#]
// First declare the delgate.
public delegate void OneArgDelegate(int weather);

// This is the method that will be called on system idle:
public void UpdateWeather(int weather)
{
...
}

// Schedule the above method for execution in the UI thread on system idle.
tomorrowsWeather.Dispatcher.BeginInvoke(
System.Windows.Threading.DispatcherPriority.SystemIdle,
new OneArgDelegate(UpdateUserInterface),
weather);


The other dispatcher priority options that are available are:


SystemIdle,
ApplicationIdle,
ContextIdle,
Background,
Input,
Loaded,
Render,
DataBind,
Normal,
Send


© 2001-2010 Copyright Syncfusion Inc. All rights reserved.  |  Privacy Policy  |  Contact  |  Sitemap