Do I need to implement INotifyPropertyChanged when using EF Code-First?

前端 未结 2 539
一整个雨季
一整个雨季 2021-01-21 15:53

I\'m noticing that when using EF CodeFirst, and binding my UI to an ObservableCollection via the DBSet.Local property recommended here, that the UI will up

2条回答
  •  一生所求
    2021-01-21 16:33

    Yes,

    Every element that you want to update the UI when a property of it is modified must implement INotifyPropertyChange.

    The reason for this is, the UI knows when the collection changes, but if the property of one of those elements changes, there is no CollectionChanged event associated with it, so the UI is ignorant

    See also: Entity Framework CTP5 Code First, WPF - MVVM modeling

提交回复
热议问题