How to update ObservableCollection from inside a BackgroundWorker using MVVM?

前端 未结 4 2158
感动是毒
感动是毒 2020-12-19 12:17

since two days I am trying to solve the following problem: I have a WPF control where a WrapPanel is bound to an ObservableCollection. An action changes the content of the O

4条回答
  •  情深已故
    2020-12-19 13:05

    You can update your collection in the BackgroundWorker.RunWorkerCompleted event handler. It runs in the same synchronization context you started it which is a UI thread usually so you can safely use any UI related stuff from there.

提交回复
热议问题