Applies to Wpf-Ribbon 1.7 and later.

Wpf-Ribbon™ provides great integration with WPF Command model. This support allows you to easily manage the multiple instances of the same button that you place on for example RibbonBar and Quick Access Toolbar.

In the core of the Wpf-Ribbon™ command support are following classes:

  • ButtonDropDownCommand
    If you are creating your own custom commands you should use the ButtonDropDownCommand. It allows you to assign the button Header (text that is displayed on the button), button Image (both large and small) and IsChecked property through the command. Once you assign the command to the ButtonDropDown the button will take these shared values from the command so you do not have to assign them directly to the ButtonDropDown and more importantly not assigned them if you have button with the same function (command) elsewhere in your application. Changing any of these properties on the ButtonDropDownCommand object will be reflected to all buttons that use same command. Each instance of the ButtonDropDownCommand can have different visual appearance but they will all share these key common properties.
    Following properties are shared between buttons that use same command: Header, Image, ImageSmall and IsChecked
  • ButtonDropDownCommandExtender
    If you are using the WPF built-in commands, like ApplicationCommands ButtonDropDownCommandExtender allows you to extend such command with key ButtonDropDown properties that will be shared among all instances of ButtonDropDown controls that use same command. You create new instance of the extender and using the static methods on RibbonCommandManager you connect the existing command that are based on ICommand interface to the extender.
  • RibbonCommandManager
    Provides the methods to connect and disconnect extenders (ButtonDropDownCommandExtender) and built-in commands based on the ICommand interface.

For an concrete example please take a look at the RibbonPad sample that is included with Wpf-Ribbon™ which shows how to use the Wpf-Ribbon™ routed command support.

Related posts:

  1. Key Wpf-Ribbon RibbonBar Control Properties
  2. Using Wpf-Ribbon Galleries
  3. How To Start Using Wpf-Ribbon Control
  4. How to implement Live Preview using DotNetBar for WPF
  5. How to disable run-time customization for buttons