Thread safety, lists, binding and WPF

后端 未结 2 960
慢半拍i
慢半拍i 2021-01-17 04:02

I have a WPF ListView that is bound to a collection (List). It is currently updated from the current thread which works ok.

I want to move the

2条回答
  •  情书的邮戳
    2021-01-17 04:22

    You can make the collection update from Dispatcher.Invoke to avoid those threading problems:

    void ThreadProc()
    {
       window.Dispatcher.Invoke(() => {
          //UpdateList
       });
    }
    

提交回复
热议问题