我想禁用一个按钮,同时它的命令正在处理。
public ICommand Search { get; set; }
private void InitilizeSearchCommand()
{
Search = new RelayCommand<string>(
param => DoSearch(param),
param => !_isSearchInProgress);
}
如何修改 _isSearchInProgress?我无法在“执行”委托中执行此操作,因为它从无法访问该字段的位置(RelayCommand 对象)执行(如果我的理解是正确的):
Search = new RelayCommand<string>(
param =>
{
_isSearchInProgress = true;
DoSearch(param);
_isSearchInProgress = false;
},
param => !_isSearchInProgress);
提前感谢您的帮助。