Search code examples
c#janus

How to add items to janus UIButton c#


As i see in janus there is UIButton that has an arrow on it , so when you click on it , it can open a menu.

I dont know how to add items so when you click on that Arrow, that is on UIButton, the menu will be open.

Can someone explain me please?


Solution

  • You will need to set the ButtonStyle to DropDown. It will now accept a new property called DropDownContextMenu, which will allow you to attach a context menu to the UIButton dropdown. Here's a quick example setting it in code:

    public Form1()
        {
            InitializeComponent();
            uiButton1.ButtonStyle = Janus.Windows.EditControls.ButtonStyle.DropDown;
            var menu = new Janus.Windows.UI.CommandBars.UIContextMenu();
            menu.Commands.Add(new Janus.Windows.UI.CommandBars.UICommand("1", "Item1"));
            menu.Commands.Add(new Janus.Windows.UI.CommandBars.UICommand("2", "Item2"));
            uiButton1.DropDownContextMenu = menu;
        }