Upgraded to v4 now relay commands not working

Nov 14, 2011 at 9:37 PM
Edited Nov 15, 2011 at 1:24 AM

I just upgraded to v4 of MVVM light. Unfortunately, my enable and disable features of RelayCommand are no longer working. Any help would be great. I am using WPF.

If I force a call to RaiseCanExecuteChanged() it works fine. But that is a horrible thing to have to do for each Command.

Coordinator
Nov 15, 2011 at 10:33 AM

Hi,

Are you using WPF?

Thanks,
Laurent

Nov 15, 2011 at 2:03 PM

Sorry I updated my original post a min later with the following.

 

I am using WPF 4.

If I force a call to RaiseCanExecuteChanged() it works fine. But that is a horrible thing to have to do for each Command.

Nov 15, 2011 at 3:45 PM

I was able to find a reference to the same issue in the Issue Tracker. If I don't use the CommandManager what is the best practice for explicitly calling the RaisCanExectueChanged() method?

Nov 15, 2011 at 5:27 PM

For the time being I rebuilt v4 with code from v3 to use CommandManager. I will refactor my code slowly to use the new method.

Coordinator
Nov 20, 2011 at 6:52 PM

Hi, sorry for the delay

In WPF MVVM Light V4, I changed the way that the RelayCommand raise the CanExecuteChanged. My goal was to make the implementation closer from the Silverlight one, and also to avoid using the CommandManager class which always seemed flaky to me.

However this is a breaking change that has been annoying some users (which I can understand), so I am considering reverting to an implementation allowing using the CommandManager or (optionally) to use the Silverlight way.

Sorry for the worries in the meantime. I would recommend keeping the V3 implementation for the time being. 

Cheers,

Laurent