相关疑难解决方法(0)

ObservableCollection没有注意到它中的Item何时发生变化(即使使用INotifyPropertyChanged)

有谁知道为什么这段代码不起作用:

public class CollectionViewModel : ViewModelBase {  
    public ObservableCollection<EntityViewModel> ContentList
    {
        get { return _contentList; }
        set 
        { 
            _contentList = value; 
            RaisePropertyChanged("ContentList"); 
            //I want to be notified here when something changes..?
            //debugger doesn't stop here when IsRowChecked is toggled
        }
     }
}

public class EntityViewModel : ViewModelBase
{

    private bool _isRowChecked;

    public bool IsRowChecked
    {
        get { return _isRowChecked; }
        set { _isRowChecked = value; RaisePropertyChanged("IsRowChecked"); }
    }
}
Run Code Online (Sandbox Code Playgroud)

ViewModelBase包含所有东西RaisePropertyChanged等等,它除了这个问题以外的所有其他工作..

c# observablecollection inotifypropertychanged

158
推荐指数
10
解决办法
16万
查看次数