我在viewmodel中有网络调用 ,返回的消息处理observe property时候报错
Invalid cross-thread access.
线程不是同一个线程,我如何在vm在知道ui线程,然后如何调用才不会出错。。
总不能把页面对象放到vm中 用view.dispatcher吧。。
求指点。。
------解决方案--------------------
用静态的Application.Current.RootVisual.Dispatcher.BeginInvoke试试。
------解决方案--------------------
Deployment.Current.Dispatcher.BeginInvoke(new Action(() =>
{
//这里填你的代码
}));