Replies: 1 comment
-
it depends what you're trying to observe if you want to just observe if the command can or is executing you can use the following observables (also showing how to watch for exceptions)
if you're wanting the output of the command, it "can" be "easier" (if it's a read only value that gets pulled from the command and isn't changed once in the view model) to push into an observable property first. in the constructor of your subviewmodel
then you want the following in your main view model
you could use |
Beta Was this translation helpful? Give feedback.
-
I have a ViewModel name MainViewModel which host another ViewModel name SubViewModel as Property. In the SubViewModel, there is a command named Select. I want to observe this command invoke in the MainViewModel to do some side effect.
I tried this in MainViewModel's constructor, but not workd.
SubViewModel.WhenAnyObservable(x=>x.Select).Subscribe(x=>{//todo});
Beta Was this translation helpful? Give feedback.
All reactions