Windows 8 App The application called an interface that was marshalled for a different thread

走远了吗. 提交于 2019-12-04 06:14:33
MikeDouglasDev

I talked with Jeffrey Richter and he gave me the answer. From the View Model, I can get to the Dispatcher via CoreApplication.MainView.CoreWindow.

Here is the update:

var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher;

await dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => {
    this.UserInfoList = new ObservableCollection<UserInfo>(userInfos);
});

I hope this helps someone else.

Mike

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!