Must create DependencySource on same Thread as DependencyObject

后端 未结 3 1049
甜味超标
甜味超标 2021-01-04 14:10

I have an application written in wpf, which downloads some webpages, parses html code and saves some values.

class ListOfItems
{    
    public List

        
3条回答
  •  时光说笑
    2021-01-04 14:38

    I think the standard way is to derive the data object from Freezable and Freeze it before passing it to another thread. Once the object is frozen, you can't change it any more, so there's no danger of threading bugs.

    Another option might be to make the data object a plain C# object (not derived from DispatcherObject) and implement INotifyPropertyChanged yourself.

提交回复
热议问题