更新时间:2023-11-30 21:37:16
在 BaseCommand
中,将 CanExecuteChanged
替换为以下内容。
Inside BaseCommand
, replace the CanExecuteChanged
to look like the following. And it will work the way you want it.
public event EventHandler CanExecuteChanged
{
add
{
CommandManager.RequerySuggested += value;
}
remove
{
CommandManager.RequerySuggested -= value;
}
}