<Button x:Name="CancelCommand" Content="Cancel" /> <<Convention will work
<Button Content="Cancel" Command="{Binding CancelCommand}" /> << but you lose some automagic abilities
Is all you will need, convention will take care of wiring up the "CancelCommand" in your viewmodel to the control thru binding that is built into CM. Effectively you have broken the mechanic which your "double" binding of the name to command... Essentially you don't need to set anything to Command at all with conventions that CM already takes care of with smoke and mirrors for you.
Aside from that also be thinking of guard properties if necessary probably not necessary in this case, but creating a bool property with "Can" as part of the prefix of the property tells CM hey we have something to check before we are allowing the button to be enabled...
e.g. CanCancelCommand , CanSubmit, etc.
hth
Morgan
<Button Content="Cancel" Command="{Binding CancelCommand}" /> << but you lose some automagic abilities
Is all you will need, convention will take care of wiring up the "CancelCommand" in your viewmodel to the control thru binding that is built into CM. Effectively you have broken the mechanic which your "double" binding of the name to command... Essentially you don't need to set anything to Command at all with conventions that CM already takes care of with smoke and mirrors for you.
Aside from that also be thinking of guard properties if necessary probably not necessary in this case, but creating a bool property with "Can" as part of the prefix of the property tells CM hey we have something to check before we are allowing the button to be enabled...
e.g. CanCancelCommand , CanSubmit, etc.
hth
Morgan