I am trying to find a way to change the predicate of a ReactiveUI ReactiveCommand during command's lifetime:
public class Form1ViewModel
{
public Form1ViewModel()
{
TestAction = () => Observable.Start(() => { MessageBox.Show("Initial step"); });
TestCommand = ReactiveCommand.CreateFromObservable(TestAction);
TestCommand.ThrownExceptions.Subscribe(ex => MessageBox.Show(string.Format("Something went wrong while executing test command: {0}", ex)));
TestAction = () => Observable.Start(() => { MessageBox.Show("Another step"); });
}
public ReactiveCommand TestCommand { get; set; }
public Func<IObservable<Unit>> TestAction { get; set; }
}
When executing command from the view binded to this viewmodel, it always gives "Initial step" message instead of "Another step". Any ideas would be appreciated.