I got a WPF application that shows a button bound to a command like that:
<Button Command="{Binding Path=TestrunStartCommand}" Content="GO!">
The command is defined like that:
public ICommand TestrunStartCommand
{
get { return new RelayCommand(TestrunStartExecute, () => !IsTestrunInProgress); }
}
public bool IsTestrunInProgress
{
get{
return _isTestrunInProgress;
}
set{
_isTestrunInProgress = value;
RaisePropertyChanged(IsTestrunInProgressPropertyName);
}
}
The problem is, the button won't be enabled immediately after I set IsTestrunInProgress
to false, but only after I click inside the application window.
Could you help me understand this behaviour and show me how to fix this?
Further reading: wpf command pattern - when does it query canexecute
only after I click inside the application window
; are you implying that the currently active window in the OS is not this programs window? Or in other words, this application is up and running, but you're in Notepad and you can just see the window in the background. – GlucinumCanExecuteChanged
is only evaluated if I click inside my window. – Verditer