Take the 2-minute tour ×

I am using a third-party Windows Forms control that performs some actions "delayed" using the Application.Idle event.

Now that we're moving our application to WPF, these actions stopped working. I've found that the System.Windows.Forms.Application.Idle event is not raised as expected.

How can I get the Idle event to fire in a WPF application so that I can continue to use that third-party control (within a WindowsFormsHost)? It is not possible to modify the Windows Forms control.

share|improve this question

2 Answers 2

up vote 7 down vote accepted

You should read this page on MSDN which describes the message loop behavior in a WPF application. In particular it looks like the ComponentDispatcher class can be used to catch a ThreadIdle event which would roughly correspond to the Windows Forms Application.Idle event.

You could then presumably use the System.Windows.Forms.Application.RaiseIdle method to raise the Idle event as the component expects.

share|improve this answer
Thanks, I did not know about ComponentDispatcher. One line (ComponentDispatcher.ThreadIdle += (sender, e) => System.Windows.Forms.Application.RaiseIdle(e);) and my problem is solved! –  Daniel Feb 26 '10 at 21:16

If you are using a WPF Application, you are actually no longer using the System.Windows.Forms.Application class to run your application, even if your application contains a Windows Forms Control.

Instead, you are using the System.Windows.Application class (different namespace).

share|improve this answer
As the OP indicated, he is in an interop scenario using a control that cannot be modified. –  Josh Feb 26 '10 at 20:18

Your Answer


