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

标签 wpf vb.net mvvm

为 ObservableCollection 调用 OnPropertyChanged 仅在集合的属性发生某些更改时才有效,而不是它包含的对象(添加、删除、清除等)。

有没有办法通知 View 集合中的项目发生了变化?

最佳答案

它包含的对象也必须实现 INotifyPropertyChanged。在您的 setter 中触发事件,只要您使用双向绑定(bind)或只读绑定(bind),WPF 就会接收并读取新值。

关于WPF MVVM : Notifying the View of a change to an element within an ObservableCollection?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3356710/

相关文章:

mysql - 从 mysql 中选择放入变量 VB.NET

c# - 在 setter 中确定调用者——或静默设置属性

.net - MVVM Light 的 SimpleIoC 背后是什么

c# - 无法在MVVM中覆盖

c# - Prism:区域停用时出现 InvalidOperationException。 "Deactivation is not possible in this type of region."

vb.net - 对象的深拷贝

.net - 将 WPF 应用程序重写为 Surface

c# - 如何创建共享代码项目 (.shproj)

WPF:从 ControlTemplate 绑定(bind)到命令

c# - 为输入创建非矩形控件