ObservableCollection not noticing when Item in it changes (even with INotifyPropertyChanged)

前端 未结 18 2910
一生所求
一生所求 2020-11-22 02:06

Does anyone know why this code doesn\'t work:

public class CollectionViewModel : ViewModelBase {  
    public ObservableCollection Con         


        
18条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 02:56

    To Trigger OnChange in ObservableCollection List

    1. Get index of selected Item
    2. Remove the item from the Parent
    3. Add the item at same index in parent

    Example:

    int index = NotificationDetails.IndexOf(notificationDetails);
    NotificationDetails.Remove(notificationDetails);
    NotificationDetails.Insert(index, notificationDetails);
    

提交回复
热议问题