C1CommandHolder with Ribbon, context menus and toolbars

Posted by: wolfgangweh on 27 September 2017, 12:11 pm EST

    • Post Options:
    • Link

    Posted 27 September 2017, 12:11 pm 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

  • Posted 27 September 2017, 12:11 pm EST

    Hi,

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

    ~nilay

    2017/04/RibbonCommand.zip

  • Posted 27 September 2017, 12:11 pm EST

    Hi Nilay,

    thanks for your efforts, much appreciated!

    Best Regards

    Wolfgang

  • Posted 27 September 2017, 12:11 pm EST

    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. - [b]Provides an idle-time automatic update of commands' status such as visible, enabled, checked[/b]...
    @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

  • Posted 8 July 2019, 3:53 am EST

    Dear Sir/Mam,

    please help me.

    I want to open its submenu when shortcut pressed…

    it’s not working…

    private void C1CommandHolder1_CommandClick(object sender, CommandClickEventArgs e)

    {

    //e.CallerLink getting null after shortcut key pressed

    C1Command menu = e.CallerLink.Command;

    e.CallerLink.OpenSubmenu(true);

    }

    Regards-

    Sanjeeb

  • Posted 8 July 2019, 6:29 pm EST

    Hello,

    I have created the sample in which Sub menu is opened when you pressed “F12”. Please refer to the attachment. Please explain If I am missing something at my end.

    Thanks.

    WindowsFormsApp32.zip

  • Posted 11 July 2019, 4:06 am EST

    Dear Sir,

    thankx for quick response.

    but kindly please provide the shortcut key through design time property box.

    after that run the program.

    please solve press the f12 for attached same project after running…

    Regards-

    Sanjeeb

    WindowsFormsApp32.zip

  • Posted 11 July 2019, 5:01 pm EST

    Hello,

    Please refer to the updated sample.

    Hope it helps.

    Thanks.

    WindowsFormsApp32.zip

  • Posted 11 July 2019, 11:25 pm EST

    Dear Sir,

    You have created everything in runtime.

    but I want to assign the shortcut at designtime

    to the menu created at designtime itself through property box.

    and that’s it to be run…

    which is not working…

    kindly advise the same for my last attached project…

    regards-

    Sanjeeb

  • Posted 14 July 2019, 11:52 pm EST

    Hello,

    I have set the shortcut “F12” at design time. Please refer to the attached sample.

    Thanks.

    WindowsFormsApp32.zip

Need extra support?

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

Learn More

Forum Channels