Using an image and ApplicationCommands in a RibbonButton

Jan 7, 2010 at 3:11 PM


I am trying to integrate a Ribbon into my app. My original application has buttons that use the system Cut, Copy and Paste commands, so I end up with code like:

<Button Command="{x:Static ApplicationCommands.Cut}" CommandTarget="{Binding ElementName=MainMimic}">
<ContentControl Width="20" Height="20" Content="{StaticResource CutIcon}"/>

to give me a button which invokes the usual system Cut command.

I'd like to have similar functionality in my QuickAccessToolbar but don't know how to achieve it. The CheckbookManager example code uses custom routed commands, but the example code doesn't actually plumb in the actual Cut functionality so I can't see where this is done.

I'd ideally like to do something like:

<r:RibbonButton Command="{x:Static ApplicationCommands.Cut}" r:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar">
<ContentControl Width="20" Height="20" Content="{StaticResource CutIcon}"/>

But this doesn't appear to work. I don't see my icon and if I click where the icon shoul dbe it doesn't actually work either.

Can anyone tell me how to do this? Do I need to use a RoutedCommand, create a handler and then call the system Cut command there?

Thanks in advance







Jan 13, 2010 at 3:20 PM

have you tried to use RibbonCommandEx to delegate to ApplicationCommands.Cut?