How to automatically hide button in start menu after clicking it?

2 posts, 0 answers
  1. Nismah
    Nismah avatar
    1 posts
    Member since:
    Jul 2016

    Posted 18 Jul Link to this post

    Hey
    I added a button in the start menu of RadRibbonBar. The problem is the button stays visible on the screen even after clicking it. How do I hide the start menu after the button is clicked?
  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 19 Jul Link to this post

    Hello Nismah,

    Thank you for writing. 

    Please refer to the following code snippet demonstrating how close the application menu's popup when clicking the button:
    public Form1()
    {
        InitializeComponent();
     
        RadApplicationMenuDropDown menu = this.radRibbonBar1.RibbonBarElement.ApplicationButtonElement.DropDownMenu as RadApplicationMenuDropDown;
     
        RadButtonElement btn = new RadButtonElement();
        btn.Text = "Click";
        btn.Click += btn_Click;
        menu.ButtonItems.Add(btn);
    }
     
    private void btn_Click(object sender, EventArgs e)
    {
        RadApplicationMenuDropDown menu = this.radRibbonBar1.RibbonBarElement.ApplicationButtonElement.DropDownMenu as RadApplicationMenuDropDown;
        menu.ClosePopup(RadPopupCloseReason.Mouse);
    }

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top