When will the CanExcute event be raised by the CommandSource
When will the CanExecute event be ideally raised by the control 开发者_如何转开发that realizes the ICommandSource interface? I tried to add a breakpoint to the handler to check when it is getting raised and it seems to be executed whenever the control is rendered on the screen. Can someone explain when exactly it will be raised and how to raise it at will?
Looks like CommandManager.InvalidateRequerySuggested() is the only possible way. Check these links for more details,
http://social.msdn.microsoft.com/forums/en-US/wpf/thread/b66a2fda-4e66-47fd-9b1f-1a1be1ce30bf
http://robburke.net/2008/04/23/wpf-command-pattern-when-does-it-query-canexecute/comment-page-1/
精彩评论