C# 必须在与 DependencyObject 相同的线程上创建 DependencySource

Application.Current.Dispatcher.Invoke(new Action(()=>
  {
       //修改主线程UI绑定属性代码
       Nodes = new ObservableCollection<Node>(list);
  }));


//异步模式
 Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
    //修改主线程UI绑定属性代码
    MainWindow.UsingMWVM.UsingDWC.UsingSCC.CirculationValveStatus = yPoint[pcic.StatusPoint];//修改循环阀状态
}));

 

posted @ 2024-05-27 12:37  青丝·旅人  阅读(148)  评论(0编辑  收藏  举报