在我们的 Xamarin.Forms 应用程序中,我们使用 ReactiveProperty 框架 ( https://github.com/runceel/ReactiveProperty )。
请注意这里我们只使用 ReactiveProperty 而不是 ReactiveUI。
我有一个像下面这样的 SignInViewMode 类..
public class SignInPageViewModel
{
// Constructor
public SignInPageViewModel()
{
}
// Reactive Properties
public ReactiveProperty<string> PhoneNumber { get; set; } = new ReactiveProperty<string>();
public ReactiveProperty<string> UserName { get; set; } = new ReactiveProperty<string>();
//Commands
public ReactiveCommand GoToNextCommand { get; set; } = new ReactiveCommand();
}
GoToNextCommand 绑定到视图中的 Button。我想实现 GoToNextCommand 的 CanExecute 功能(如果 UserName 或 PhoneNumber 属性中的任何一个为空,则禁用 GoToNextCommand),但我不知道如何在 ReactiveProperty 中实现这一点。
任何帮助表示赞赏。