WPF ICommand CanExecute(): RaiseCanExecuteChanged() or automatic handling via DispatchTimer?
- 阅读更多 关于 WPF ICommand CanExecute(): RaiseCanExecuteChanged() or automatic handling via DispatchTimer?
问题 I'm trying to determine the best way to cause ICommands' CanExecute() to be reflected in the UI. I understand that the Dispatcher is the WPF (engine?) that handles UI drawing, and that by default, the Dispatcher evaluates ICommands' CanExecute() method upon instantiation as well as active user interface (clicking the UI, or keyboard input.) Obviously, this is a problem when CanExecute() on any given ICommand changes, but neither mouse nor keyboard input is provided--and so the UI does not