[英]In WPF, how to pass a parameter to ICommand.CanExecute()
public bool SelectAll
{
get { return this.Get<bool>("SelectAll"); }
set
{
this.Set<bool>("SelectAll", value);
if (this.SelectAllCommand.CanExecute(null))
this.SelectAllCommand.Execute(value);
}
}
作为我的代码,我想要一个复选框-选择所有功能。 当我手动单击“全选”时,我想执行SelectAllCommand,但是如果自动选中了该复选框,则CanExecute应该向我返回false。
我没有如何将参数传递给CanExecute ...我该怎么做...?
提前致谢
好吧,在您的代码中,您当前正在传递一个参数,该参数恰好为空。 所以你不是更准确地想做
if (this.SelectAllCommand.CanExecute(value))
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.