I am using MVVM-Light RelayCommand
private ICommand myRevertCmd;
public ICommand Revert
{
get
{
if (myRevertCmd == null)
{
myRevertCmd = new RelayCommand(RevertExecute, CanRevertExecute);
}
return myRevertCmd;
}
}
private void RevertExecute()
{
searchType = SearchType.Revert;
SearchStart();
}
private bool CanRevertExecute()
{
return isRevertEnabled;
}
I have some code that changes the value of isRevertEnabled but the linked button does not change. After some searching I found that you can use to force the re-evaluation of the button states
// force the GUI to re-evaluate the state of the buttons
CommandManager.InvalidateRequerySuggested();
But this doesn't work. Does any one have any suggestions?
RelayCommand
in an additional namespace:GalaSoft.MvvmLight.CommandWpf
that specifically solves this issue! – Ninebark