How to add items to janus UIButton c#

526 views Asked by At

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?

1

There are 1 answers

0
Riv On BEST ANSWER

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;
    }