How to add drop down menu to ribbon group

Forum Forums Visual Components 4.1 .NET Addon Programming How to add drop down menu to ribbon group

This topic contains 6 replies, has 5 voices, and was last updated by Avatar Andreluizfc 10 months, 3 weeks ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #3185
    Jay
    Jay
    Moderator

    Attached is a sample project that demo adding drop down menu to VC 4.0 ribbon group.

    Attachments:
    You must be logged in to view attached files.
    #3612
    Sicario
    Sicario
    Participant

    Good work !

    #8600
    Avatar
    Andreluizfc
    Participant

    Hi, Jay.

    I was trying to implement a drop-down menu with checkboxes, but could not succeed. It was supposed to be something like the image below.

     

    Here is what I wrote.

    I click the checkbox, it call the Execute method, but it does not get checked.

    #8639
    zesty
    zesty
    Moderator

    @andreluizfc

    I don’t see where you are calling EvaluateCanExecute() nor binding menu items to events.

    MenuItemBase menu_item = new MenuItemBase(direction.ToString(), direction.ToString(), “”, this);
    menu_item.AttachTo = “[Event Click] = [Action InvokeExecute]”;
    menu_item.Execute = () => Execute(menu_item);
    _items.Add(menu_item);

    But I can test tomorrow maybe. If your execute method is being called then there is something that is not retaining the value to the checkbox. Try creating a breakpoint at the end of your Execute method to evaluate the action item. If you have snoop, you could also use that to inspect the check box itself. Otherwise, I am sure someone has the answer, but prolly hasn’t noticed the post.

    #8808
    Avatar
    Ilkka
    Participant

    What is ribbon group icon and how I can use it?

    #8897
    zesty
    zesty
    Moderator

    @andreluizfc

    Sorry for the long delay.

    To make a checkbox, you need to do this:

    1. APCheckBoxTopApproach needs to be implemented as an ActionItem<bool>. So in your collections, you would also need to update them to use ActionItem<bool>.
    2. APCheckBoxTopApproach needs to be a MenuTools.CheckableMenuTool. That would then require you to override the Execute() method

      public override void Execute(bool isChecked)
      {//insert your code}

    My friend, let me know if this helps you.

    @ilkka look at the project attached in the original post. that shows you how to implement a ribbon group. the icon itself can come from the Icons folder in VC program files or your own, just make sure it is an SVG. you will also find an old beta tutorial on this forum thread on how to use the icon.

    #9235
    Avatar
    Andreluizfc
    Participant

    @zetsy

    Thanks for the reply. I’ll test as soon as possible and let you know!

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.