canExecute problem

Nov 16, 2010 at 5:12 AM
Edited Nov 16, 2010 at 5:13 AM


I have a problem with  CanExecute logic and CommandBehaviorBase.

For example, in your  Sample project in MainViewModel class there is ICommand TextChangedCommand.

I changed this property a little :

public ICommand TextChangedCommand
if (textChangedCommand == null)
textChangedCommand = new DelegateCommand<TextChangedEventArgs>(OnTextChanged, (args) =>
if (System.DateTime.Now.Second < 30) return true;
else return false;
return textChangedCommand;

I added  CanExecute logic. This logic work properly when CanExecute return true and begin to return false.

But when CanExecute begin to return true the control (TextBox) is still disabled.

RaiseCanExecuteChanged() don't resolve problem.

Any suggestion please.