开发者

What is equivalent to Application.DoEvents() in WPF applications

开发者 https://www.devze.com 2023-03-21 19:05 出处:网络
From MSDN, it seems that Applicat开发者_如何转开发ion.DoEvents() is available in Windows.Forms. What would be the equivalent thing in WPF.While i agree with the Skeet you can find a WPF method like th

From MSDN, it seems that Applicat开发者_如何转开发ion.DoEvents() is available in Windows.Forms. What would be the equivalent thing in WPF.


While i agree with the Skeet you can find a WPF method like that on the documentation page of the DispatcherFrame


You shouldn't be using it even in Windows Forms. Don't perform long-running tasks on the UI thread - use a background thread and use the Dispatcher to update the UI as required. Any use of Application.DoEvents is basically a code smell. I don't know whether there is an equivalent in WPF, but you should try to avoid it even if there is.

0

精彩评论

暂无评论...
验证码 换一张
取 消