我有:
public class Vm
{
private ObservableCollection<Thing> _things;
public ObservableCollection<Thing> Things
{
get { return _things ?? (_things = new ObservableCollection<Thing>()); }
}
}
和
public class Thing :INotifyPropertyChanged
{
private string _value;
public string Value
{
get { return _value; }
set
{
if (value == _value) return;
_value = value;
OnPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
我想观察 ObservableCollection 中所有项目的 PropertyChanges
rx 适合这个吗?
在这种情况下,观察者是如何连接起来的?(我可以发布一些你尝试过的东西,但我认为它不会增加太多)