开发者

WPF MVVM: Notifying the View of a change to an element within an ObservableCollection?

开发者 https://www.devze.com 2023-01-09 12:26 出处:网络
Calling OnPropertyChanged for an ObservableCollection only works when there has been some change to the properties of the collection开发者_开发知识库, not the objects it contains (add, remove, clear,

Calling OnPropertyChanged for an ObservableCollection only works when there has been some change to the properties of the collection开发者_开发知识库, not the objects it contains (add, remove, clear, etc).

Is there any way to notify the View that there has been a change to an item within the collection?


The objects it contains have to implement INotifyPropertyChanged as well. In your setter you trigger the event, and WPF will pick up on this and read in the new value as long as you are using two-way bindings or read-only bindings.

0

精彩评论

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

关注公众号