Command ValidationSummary and CanExecute

Topics: Questions
Sep 15, 2014 at 10:24 AM
If I create a Command with:

CommandHelper.CreateCommand() I can add a Action and a ValidationSummaryProperty)

But how to solve if I need a additional condition to disable the command?
Sep 16, 2014 at 11:15 PM
Then you are making it too complex ;-)

What you can do is create your custom CanExecute. In that CanExecute, you can check your customer state and check the validation summary.
Sep 17, 2014 at 6:56 AM
Edited Sep 17, 2014 at 6:56 AM
I thought I can make it simple. :-). I try to add a warning to disable the command. But Warnings does not disable commands. Is that correct?
Sep 17, 2014 at 10:59 AM
A warning is a warning, not an error, so won't block the user from doing anything. It's just a "watch out, know what you are doing" sign.
Sep 17, 2014 at 12:05 PM
You can see it in different way.

For example:

I have a button its called activate. I try to activate a profile. If the profile has errors it can not be activated. So I display also the error message.

But: If no profile is selected the button should also be disabled. That's no error in my case. The function is only not available if no profile is selected.

I don't want a error message if the no profile is selected.
Sep 17, 2014 at 12:10 PM
Feel free to implement your own CanExecute, it's really simple.