MVVM / ObservableCollection Question

后端 未结 6 944
陌清茗
陌清茗 2021-01-19 15:32

I have the following XAML:

   
        

        
6条回答
  •  南笙
    南笙 (楼主)
    2021-01-19 16:08

    ObservableCollection implements INotifyCollectionChanged which informs a registered event handler about changes in the collection (add,remove,sort of items). However the DataGrid must know if a property of one of your business-objects has changed to update the value in the grid. For this, INotifyPropertyChanged is needed.
    ObservableCollection implements also INotifyCollectionChanged. However this can only be used to be informed if a property of the collection has been changed. There is no mechanism that let the collection detect if your business object has been changed (and if it would have, it would register to INotifyCollectionChanged of your business object :).

提交回复
热议问题