What's the best way to update an ObservableCollection from another thread?

后端 未结 5 972
终归单人心
终归单人心 2020-12-23 17:06

I am using the BackgroundWorker to update an ObservableCollection but it gives this error:

\"This type of CollectionVi

5条回答
  •  粉色の甜心
    2020-12-23 17:52

    Try This:

    this.Dispatcher.Invoke(DispatcherPriority.Background, new Action(
    () =>
    {
    
     //Code
    
    }));
    

提交回复
热议问题