开发者

WPF background worker need a dispatcher for bound data

开发者 https://www.devze.com 2023-01-14 08:12 出处:网络
I have all my data boun开发者_JAVA百科d from WPF controls to properties in an object that my Window can access.When I run a backgroundworker thread, do I need a dispatcher to access these underlying p

I have all my data boun开发者_JAVA百科d from WPF controls to properties in an object that my Window can access. When I run a backgroundworker thread, do I need a dispatcher to access these underlying properties, or since I'm not explicitly accessing the UI controls, is that handled automatically by the mechanism binding the XAML to the code properties?


The WPF (but not silverlight) databinding system will automatically send INotifyPropertyChanged events to the dispatcher thread, so you can trigger these from wherever you like. INotifyCollectionChanged is not so lucky, so you'll need to dispatch any changes to an ObservableCollection yourself...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号