WPF: Handling Button.Click or defining a command?
If I’ve got an Avalon Button, e.g.
<Button Content=“OK” />
Should I give the button a name so I can handle the event (I would never put the event handler directly in the XAML) like this:
<Button Content=“OK” x:Name=“okButton” />
Or, should I define a custom command and invoke it like this:
<Button Content=“OK” Command=“local:MyDialog.OkCommand” />
Defining a command seems like overkill (you do some stuff in the static ctor and some other stuff in the instance ctor), but I like consistency, e.g. my main window’s menu will use commands.
Thoughts on the best practice here?