Updating ObservableCollection Item properties using INotifyPropertyChanged

前端 未结 4 1779
小鲜肉
小鲜肉 2021-01-19 10:05

Checking to make sure my assumptions are correct.

I have an ObservableCollection class. I am calling a web service and retrieving an array of Devices. I am then enum

4条回答
  •  一生所求
    2021-01-19 10:35

    In the first example, setting the item in the collection will fire the CollectionChanged event, not the PropertyChanged event of the individual item.

    You can notify all properties by specifying an empty string to the PropertyChanged event. For example:

    item.RaisePropertyChanged("");
    

    where RaisePropertyChanged is a public method that invokes the PropertyChanged event of the INotifyPropertyChanged implementation.

提交回复
热议问题