Application.Idle event not firing in WPF application

前端 未结 2 1178
我在风中等你
我在风中等你 2020-12-11 07:19

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

相关标签:
2条回答
  • 2020-12-11 07:45

    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).

    0 讨论(0)
  • 2020-12-11 07:53

    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.

    0 讨论(0)
提交回复
热议问题