我必须从另一个线程导航到一个属于主窗口的页面。我创建了一个单独的线程来侦听另一个进程的命令行参数。当我在线程中通过IPC从进程中接收到“约”时,我需要从线程中打开about.xaml
。我该怎么做呢?
我是这样从主窗口打开页面的:
_mainFrame.Source = new System.Uri("AboutPage.xaml", UriKind.Relative);
我如何从不同的线程中做同样的事情呢?
发布于 2015-09-29 03:15:59
您可以使用dispatcher向UI线程发送操作。
Dispatcher.CurrentDispatcher.Invoke(()=>
{
_mainFrame.Source = new System.Uri("AboutPage.xaml", UriKind.Relative);
});
https://stackoverflow.com/questions/32825418
复制