ReactiveUI命令:如何在静态条件下使用canexecute

时间:2019-03-22 10:00:50

标签: c# wpf reactiveui

如何用ReactiveUI命令等效地执行此操作? 并特别处理与IObservable等效的CanExecute吗?

private readonly bool enableEdit = ctor-param;

this.AddIdCommand = new DelegateCommand(AddIdExecute, ()=>enableEdit);

1 个答案:

答案 0 :(得分:0)

如果值是静态的,则应这样做:

this.AddIdCommand = ReactiveCommand.Create(AddIdExecute, Observable.Return(enableEdit));