Can CanExecute not be a function of a parameter or is it a bad practice?
For example, the ability to execute a command depends on several VM properties. How in this case is more correct to do?
Option 1
bool CanExecute() { return Prop1 && Prop2 == 1 && Prop3 is SomeType; } Option 2
Pass in the xaml markup to the parameter all the necessary properties through MultiBinding , wrap them in a converter that simply returns object[] as an object and in CanExecute use it?
In general, I myself do not see anything wrong with the first version, the only thing that confuses me is the attachment of the command functions to the specific context in which they are located.
CanExecutecan do without a parameter. - BulsonCanExecute? More precisely, I understand that this is technically possible, but how correct is it? After all, not everything is right that is technically possible - iRumbaCanExecuteyou do not need the parameter at all; and so you can determine by the values of the properties in the view model you can execute the command or not. - Bulson