I have two ViewModels and one contains another. The inner one has a Microsoft.Practices.Prism.Commands.DelegateCommand
called PrintCommand
. It is desirable to subscribe to the CanExecuteChanged
event of this command. This part is implemented as usual:
OneViewModel.PrintCommand.CanExecuteChanged += CanExecuteChangedHandler;
The problem is that this subscription doesn't work.
Decompiled CanExecuteChanged
looks like this:
public event EventHandler CanExecuteChanged
{
add
{
WeakEventHandlerManager.AddWeakReferenceHandler(ref this._canExecuteChangedHandlers, value, 2);
}
remove
{
WeakEventHandlerManager.RemoveWeakReferenceHandler(this._canExecuteChangedHandlers, value);
}
}
When I debug, after a couple of steps after subscription the _canExecuteChangedHandlers
doesn't seem to contain any alive handlers, even though subscriber object still exists.
I'm kind of curious, why is it happening?