Background
While looking at Josh Smith's article about CommandGroup, I noticed that there are a number of comments on the Internet about how to implement ICommand.CanExecuteChanged.
A similar question was posted here on StackOverflow, but
- I don't feel like there is a clear answer, and
- there is not enough room in a comment to be able to add additional context.
For reference:
- Josh Smith's original article about
CommandGroupuses a simple .NET event - Josh Smith's
RelayCommanduses aCommandManagerimplementation ofCanExecuteChanged - Microsoft's own
RoutedCommanduses aCommandManagerimplementation ofCanExecuteChanged - Microsoft's own PRISM library (version: 6) also uses a simple .NET event (previous versions used weak references)
My Question
I am relatively new to WPF, and I would like to know how the CanExecuteChanged event should have been implemented in Josh Smith's CommandGroup to avoid any unexpected behaviors or memory leaks?
Additional Reading
Josh Smith: Aggregating WPF Commands with CommandGroup
Josh Smith: WPF apps with the MVVM design pattern
StackOverflow: Is Josh Smith's implementation of the RelayCommand flawed?