CompositeCommand without affecting IsEnabled

Topics: Prism v4 - Silverlight 4
Sep 4, 2010 at 10:07 PM

Hi all,

I am working with Prism MVVM and CSLA in Silverlight. I wanted to use the databinding in CSLA to control the IsEnabled of a button. I used a CompositeCommand to tie the xaml to the ViewModel. That all worked great. In my case, I have a CSLA object that I want to use to control the IsEnabled of that button.  The way it works now is that *if* I hook up a button using a CompositeCommand and do NOT use the CanExecute method, the buttons IsEnabled property in xaml is ignored (also just putting false in the isenabled of a button is ignored). I understand that this by design.

What I was really wishing for was a way to connect a buttons click event to the ViewModel, but leave the rest to me. I think there should be an option to use "commanding" with a Silverlight button, but also be able to bind the IsEnabled to my own object and have it respected. Right now there seems to be no way to turn that part off.


Sep 7, 2010 at 3:10 PM


Thank you for posting your question.

Have you looked at the InvokeCommandAction and CallMethodAction behaviors in the Blend SDK?  If you have Blend you can simply drag and drop them on your View.  If not, you can download the Blend SDK and hand code the XAML to wire up your Button to either an ICommand or public method on your ViewModel.

Does this help?