exposing command CanExecute as property

Jul 4, 2008 at 6:32 PM
Hi,

I've been thinking about commands in WPF, CAB and CAG.

It's desirable to expose CanExecute as property on command instead of having a CanExecute handler.
This is more the way CAB does commanding.

CAB defines also a three state command status: enabled, disabled and unavailable.
But there is no equivalent in CAG yet.

Benjamin
Jul 5, 2008 at 8:40 AM
Hi Benjamin

Our CAL commands build on top of the WPF command infrastructure. WPF defines the ICommand interface that has CanExecute method. DelegateCommand implements ICommand so it requires the CanExecute method. The reason CanExecute is a method and not a property is so that the Parameters for the command can be passed in to CanExecute. If it was a property the you would not be able to pass these parameters in.
Jul 5, 2008 at 9:35 AM
Glen,

but how would you make a button invisible which is bound to a command?

Benjamin