As I am trying to remove old implementations of ReactiveList, I find myself trying to implement a way to remove an item from a DynamicData collection when a ReactiveCommand in the said item is triggered.
The old implementation worked like this:
OldReactiveList
.ObserveProperty(vm => vm.RemoveCommand)
.Subscribe(vm => OldReactiveList.Remove(vm));
Is there a way to implement a similar structure with an observable change set from a DynamicData SourceList?
Everything I've tried so far seems to fail to either not knowing which item triggered the observation, or the observing relying on the observable property actually changing.
The cleanest solution I have come up with would be to modify the originally "empty" remove command to return "self":
And then use
SubscribeManyto listen to these commands and get the item to remove from the list:The
ViewModelListcould be implemented viaSourceListorSourceCache, but the solution would be mostly the same. Only the way to access the change set would change.