You can attach ICommand to another property and execute it from the Click handler.
<Button x:Name="MyButton" Tag="{x:Static ApplicationCommands.Stop}" Click="MyButton_Click" />
and in the handler:
private void MyButton_Click(object sender, RoutedEventArgs e) { var button = sender as Button; if (button != null) { var command = button.Tag as ICommand; if (command != null) command.Execute(button.CommandParameter); } }
You will also need to do extra work if you want to keep the command disconnect behavior.
John bowen
source share