WPF/Prism/MVVM Button/DelegateCommand binding with user-defined button disable logic?

377 Views Asked by At

What I want to do is bind a SaveCommand DelegateCommand to a button, but instead of having the CanExecute() == false disable the button, I'd prefer the button be clickable but just run field validation and display a message box if fields are invalid.

I'm using MVVM and would like to achieve this without doing something hackity.

1

There are 1 best solutions below

1
On BEST ANSWER

Why not just have your Execute method of the command do as you state and only use the CanExecute to enable/disable the button? If you don't need to ever disable the button, then only use the Execute portion...