【发布时间】:2018-04-16 09:31:44
【问题描述】:
在我们的 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 绑定到视图中的按钮。我想实现 GoToNextCommand 的 CanExecute 功能(如果 UserName 或 PhoneNumber 属性中的任何一个为 null,则禁用 GoToNextCommand),但我不知道如何在 ReactiveProperty 中实现。
感谢任何帮助。
【问题讨论】:
标签: xamarin.forms reactive-programming reactive-property