The following line throws a runtime exception:
Accept = ReactiveCommand.Create(this.WhenAnyValue(x => x.Canexecute()));
Here's the code:
public class InstructionsViewModel : ReactiveObject
{
public InstructionsViewModel()
{
Accept = ReactiveCommand.Create(this.WhenAnyValue(x => x.CanExecute));
Accept.Subscribe(x =>
{
Debug.Write("Hello World");
});
}
public ReactiveCommand<object> Accept { get; }
bool _canExecute;
public bool CanExecute { get { return _canExecute; } set { this.RaiseAndSetIfChanged(ref _canExecute, value); } }
}
Error:
Cannot convert lambda expression to type 'IObserver' because it is not a delegate type
I've also tried the following:
public InstructionsViewModel()
{
Accept = ReactiveCommand.Create(this.WhenAnyValue(x => x.Canexecute()));
Accept.Subscribe(x =>
{
Debug.Write("Hello World");
});
}
public ReactiveCommand<object> Accept { get; }
public bool Canexecute() => true;
I receive the following error:
An exception of type 'System.NotSupportedException' occurred in ReactiveUI.dll but was not handled in user code
Additional information: Index expressions are only supported with constants.
Is this even supported on Windows Phone 10?