I have a Class, MyClass
that implements INotifyPropertyChanged
and has some properties that implement PropertyChanged
. When MyClass.MyProperty
changes, PropertyChanged
fires as expected. Another class contains a SortedList<MyClass>
.I've tried merging the events into a single observable in the class that contains the SortedSet<MyClass>
and subscribing to it, but it doesn't seem to ever have any events. Here's what I'm trying:
Observable.Merge(MySortedList.ToObservable())
.Subscribe(evt => Console.WriteLine("{0} changed", evt.MyProperty));
What I'm trying to get is a single observable that contains all of the events from every item in my SortedList<MyClass>
. I've tried using ObservableCollection instead, but that doesn't change anything, nor would it be expected to, really, since it doesn't fire collectionchanged when a property of a contained item changes, anyway. I can listen to individual elements in SortedList<MyClass>
and see the PropertyChanged event fire, but what I want is a single Observable that contains a stream of ALL of the PropertyChanged events from all of the elements in SortedList<MyClass>
.
It seems like this should be something fairly easy to do using Rx, but I can't seem to figure out how.