Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WPF以一定的延迟更新UI_Wpf_Multithreading - Fatal编程技术网

WPF以一定的延迟更新UI

WPF以一定的延迟更新UI,wpf,multithreading,Wpf,Multithreading,我有一个幻灯片应用程序,我想等待一定的秒数,然后显示我的首页,然后再次等待,然后显示下一页,依此类推。我的问题是,当我使用Thread.Sleep时,UI没有更新,它只是在那里等待,我只看到我的最后一个控件(在全部时间过后(即所有睡眠)。有什么解决方案吗 Thread.Sleep(1000); ChangeContent(new FrontPage()); Thread.Sleep(5000); ChangeContent

我有一个幻灯片应用程序,我想等待一定的秒数,然后显示我的首页,然后再次等待,然后显示下一页,依此类推。我的问题是,当我使用Thread.Sleep时,UI没有更新,它只是在那里等待,我只看到我的最后一个控件(在全部时间过后(即所有睡眠)。有什么解决方案吗

 Thread.Sleep(1000);
            ChangeContent(new FrontPage());
            Thread.Sleep(5000);
            ChangeContent(new HtmlPage());
在WPF之前,我只会使用Application.DoEvents。

使用一个