Flicker window when positioning in WPF
I am working on a WPF application, the problem I am facing is Screen Flickers, for example it positions itself at load time. I want to hide this, or something similar, until it is fully loaded and then display it.
I'm trying to use recursive messaging for this, just like DoEvents in winform apps.
Something like
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate{});
thank
+3
source to share
1 answer
You can use your own DoEvents method like this:
public void DoEvents()
{
DispatcherFrame frame = new DispatcherFrame();
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, (Action<DispatcherFrame>)(frm => { frm.Continue = false; }), frame);
Dispatcher.PushFrame(frame);
}
+1
source to share