steviesama
steviesama

Reputation: 337

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

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.

Upvotes: 0

Views: 374

Answers (1)

Panh
Panh

Reputation: 225

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...

Upvotes: 1

Related Questions