WPF Databinding thread safety?

后端 未结 3 587
忘掉有多难
忘掉有多难 2020-11-29 04:39

Well lets say i have an object that i databind to, it implements INotifyPropertyChanged to tell the GUI when a value has changed...

if i trigger this from a differen

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 05:22

    Value changes fired by INotifyPropertyChanged are automatically marshalled back onto the dispatcher. (http://blog.lab49.com/archives/1166)

    Fire this event on any thread you like...


    Value changes fired by INotifyCollectionChanged are NOT reliably marshalled onto the dispatcher. (http://csharplive.wordpress.com/2008/09/11/wpf-data-binding-observablecollection-cross-thread-binding-support/)

    If you need to update an observable collection from a different thread, follow the advice in this link

提交回复
热议问题