ICommand .
.
public class MyCommand : ICommand
{
public void Execute(object parameter)
{
string hello = parameter as string;
MessageBox.Show(hello, "World");
}
public bool CanExecute(object parameter)
{
return true;
}
public event EventHandler CanExecuteChanged;
}
.
<DockPanel.Resources>
<local:MyCommand x:Key="mycmd"/>
</DockPanel.Resources>
xaml, .
<ribbon:RibbonButton Command="{StaticResource mycmd}" CommandParameter="Hello, command" Label="Copy" LargeImageSource="Images/LargeIcon.png"/>