WPF Application developers would be experiencing or would have observed that after updating MVVMLight Toolkit package to Version 5.0.0 or 5.0.1, RelayCommand - CanExecute() mechanism is not working anymore.

This issue is been already reported by MVVMLight user on codeplex as Issue# 7659.

As explained by Laurent:

WPF is the only XAML framework that uses the CommandManager to automagically raise the CanExecuteChanged event on ICommands. Unfortunately, there is no CommandManager in PCL (portable class library).

CanExecute() is an input parameter of type action, it can be a method that returns bool based on which binding updates to allow or block command execution. This is to be passed when instantiating RelayCommand property that will bind with your control's Command property and fire the default event based on user action.

A hot fix is released for above mentioned issue as Version 5.0.2 and now available on NuGet for update.

Imp: The fix is not applied by default. As originally and even now the RelayCommand is available in GalaSoft.MvvmLight.Command namespace of GalaSoft.MvvmLight library. This is the new implementation for RelayCommand (the PCL version).

RelayCommand for WPF that supports CanExecute() invoke automagically is now shifted to GalaSoft.MvvmLight.CommandWpf namespace of GalaSoft.MvvmLight.Platform library.

What does this mean?

To apply the CanExecute() not working issue - hotfix, you need to change the namespace GalaSoft.MvvmLight.Command to GalaSoft.MvvmLight.CommandWpf.

Note: This fix only applies to WPF - MVVM light toolkit consumer applications as specified by Laurent.

Full change-log can be found at this location.

Thank you Laurent for the fix, Happy Coding !!