Search code examples
wpfribbonribboncontrolslibrary

RibbonCommand was not found


I see the majority of WPF Ribbon examples out there use some code like

xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"

I'm getting this error..."The type 'r:RibbonCommand' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built."

Using VS 2010, .NET 4.0.

I'm trying to figure out how to add a button to the ribbon and execute code/command when it's clicked.

Thanks.


Solution

  • If you are using the new Microsoft WPF Ribbon, the RibbonCommand type has been removed. The Command property is now an ICommand type.

    To set the command on a RibbonButton, you can do the following:

    <ribbon:RibbonButton Command="ApplicationCommands.Copy" />
    

    or use any command that implements ICommand.