C1CommandHolder with Ribbon, context menus and toolbars

Originally Posted 16 March 2017, 11:29 am EST

  • Originally Posted 16 March 2017, 11:29 am EST

    Hi C1 Experts,

    I have a number of generic commands which shall be available and executable from a main form, user controls and/or MDI forms.

    The main form has a ribbon, while in the user controls you might just have buttons, context menus, perhaps a toolbar or so.

    I sometimes want to show context menus which match ribbon groups. The buttons in the ribbon group should match the menu items in the context menu.

    I understand that the C1CommandHolder can be used to define commands, and these commands can be linked to
    to ribbon, toolbar or menu items.

    I haven't used the C1CommandHolder yet.

    Is this a good idea? Experiences, recommendations?

    Is there an example which shows the combination of all these controls?

    Will all linked UI elements update when properties of the command in the CommandHolder change (Enabled, Checked, Visisble, etc..)?

    For another project I've created helper functions to create context menus from ribbon groups.
    Is there a way to (semi-)automatically match ribbon groups and context menus?

    Any information or advice is welcome.

    Thanks

    Wolfgang
  • Reply

    Hi Wolfgang,

    @WolfgangWeh said:
    Is this a good idea? Experiences, recommendations?


    Theoretically, it is possible to write an adapter between C1Command and C1Ribbon. If multi-level menu-merging work good with C1Ribbon, this use case would work fine with C1CommandHolder. As a container for commands, C1CommandHolder corresponds to a single form. I am not sure how MDI forms come into play here. Also note that, even if you do not add C1CommandHolder manually, it is created behind the scenes automatically to manage C1Command.

    @WolfgangWeh said:
    Is there an example which shows the combination of all these controls?


    I can write an example for you. Give me a few more days. As of now, if you need any suggestion, refer these samples:
    http://www.componentone.com/Studio/Pages/Samples/winforms-createmenusincode
    http://www.componentone.com/Studio/Pages/Samples/winforms-nonmdimenumerge
    http://www.componentone.com/Studio/Pages/Samples/winforms-simplemenusincode
    http://www.componentone.com/Studio/Pages/Samples/winforms-banktellerwithcabextensionkit
    http://www.componentone.com/Studio/Pages/Samples/winforms-simpletexteditor
    http://www.componentone.com/Studio/Pages/Samples/winforms-c1commandbasedapp
    http://www.componentone.com/Studio/Pages/Samples/winforms-c1ribbonbasedapp
    http://www.componentone.com/Studio/Pages/Samples/winforms-createappmenu

    @WolfgangWeh said:
    Will all linked UI elements update when properties of the command in the CommandHolder change (Enabled, Checked, Visible, etc..)?

    Yes!!
    Command holder provides the following features:
    - It is also an IExtenderProvider providing a C1ContextMenu property to all controls on the form.
    - Provides an idle-time automatic update of commands' status such as visible, enabled, checked...


    @WolfgangWeh said:
    Is there a way to (semi-)automatically match ribbon groups and context menus?


    Theoretically yes. Let me work on this. I would update the same in the sample I am going to follow up with this.

    ~nilay
  • Marked as Answer

    Reply

    Hi,

    Please find the attached sample which depicts how to use C1Ribbon items with C1Command.

    ~nilay
    2017/04/RibbonCommand.zip
  • Reply

    Hi Nilay,

    thanks for your efforts, much appreciated!

    Best Regards

    Wolfgang
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels