I would like to observe a property path: MainViewModel.Project.SelectedDocument.Align
Align
is regular property of typeReactiveCommand<Unit, Unit>
.Project
andSelectedDocument
are regular properties.
I'm using this to create the observable (from MainViewModel
):
var commandObs = this
.WhenAnyObservable(x => x.Project.SelectedDocument.WhenAnyValue(y => y.Align));
I'm getting an exception on this line with the following message:
System.NotSupportedException: 'Index expressions are only supported with constants.'
What's wrong?
Since the WhenAnyObservable
method requires an observable property at the end of the property path, I'm creating it with the inner WhenAnyValue. Is that the problem? Should the property expression a simple access expression instead of a method call?
In any case, I took the code from this answer: ReactiveUI How to use WhenAnyObservable properly
It supposedly works :) but not for me in this case.