我正在开发一个WPF应用程序,遇到的问题是屏幕闪烁,就像它在加载时自行定位一样。我想在它完全加载之前隐藏它或使用其他方法来处理。
我尝试使用递归消息泵来解决这个问题,类似于winform应用程序中的DoEvents。
类似于以下代码:
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate{});
谢谢
public void DoEvents()
{
DispatcherFrame frame = new DispatcherFrame();
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, (Action<DispatcherFrame>)(frm => { frm.Continue = false; }), frame);
Dispatcher.PushFrame(frame);
}