在ViewModel中使用:
((App)App.Current).RootFrame.Dispatcher.BeginInvoke(new Action(() =>
{
}));
App.Current.RootVisual.Dispatcher.BeginInvoke(() =>
{
});
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
});
在需要更新UI的地方添加以上語句中的一條。
如果在View,即(MainPageXXX.xaml.cs)中使用以下語句:
this.Dispatcher.BeginInvoke(() =>
{
//do something
});