请不要严格判断这个问题是以前讨论过还是间接在附近的巨大棱镜和 mvvm 博客中回答过。在 RelayCommand 或 DelegateCommand 类的 WPF 实现中,有一个这样的事件处理程序
/// <summary>
/// Occurs whenever the state of the application changes such that the result
/// of a call to <see cref="CanExecute"/> may return a different value.
/// </summary>
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
但在命名空间的 SL 子集中没有 CommandManager 类。这就是我卡住的地方。在 SL 的 MVVM 采用中,我还没有找到解决方法(PRISM 对我来说还很复杂)。不同的简单 HelloWorldMVVM 应用程序根本不处理。
在此先感谢并为我的英语感到抱歉-)