WPF Application.DoEvents()


VB6 or even .Net programmers know that in order not to block a desktop application UI when processing longer tasks, there is a little trick that can be applied, if the tasks contain a loop, which loop will allow a call to:
which will process Windows waiting messages.
But in WPF there is no such default method.
There are different approaches and implementations, but if you look for a fast solution, you can just add a reference to
and the corresponding using directive and Application.DoEvents() is ready to use !
I usually use a directive with alias, in order not to conflict with other existing namespaces:
using SysWinForms = System.Windows.Forms;
So you can simply call:


%d bloggers like this: