I want to disable a button, while its command is processing.
public ICommand Search { get; set; }
private void InitilizeSearchCommand()
{
Search = new RelayCommand<string>(
param => DoSearch(param),
param => !_isSearchInProgress);
}
How can I modify _isSearchInProgress? I could not do it inside "Execute" delegate because it executes from place (RelayCommand object) where the field is not accessible (if my understanding is true):
Search = new RelayCommand<string>(
param =>
{
_isSearchInProgress = true;
DoSearch(param);
_isSearchInProgress = false;
},
param => !_isSearchInProgress);
Thanks in advance for any help.