RadToolStripOverflowButtonElement

3 posts, 1 answers
  1. Vera
    Vera avatar
    2 posts
    Member since:
    Feb 2008

    Posted 10 Apr 2008 Link to this post

    Hello,

    I would like to only have the "Minimize the Ribbon" option in the RadToolstripOverflowButtonElement's Items Collection, but I haven't found a way to access this.

    If I look at the Items Collection for the RadToolstripOverflowButtonElement on the form itself, there are no items present to remove.
    I have used the RadControlSpy to see if this would give me a way to remove the additional items currently there and although it is successful while in Run mode, the modifications then disappear once I close and rerun the app. The interesting thing is that when I initially start the app and look at this control with Control Spy it doesn't show any items in the Collection either. Only when this control has already been clicked on do the items appear in Control Spy.

    Can anyone help me understand this please.
    Many thanks,
    Viv

  2. Answer
    Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 14 Apr 2008 Link to this post

    Hello Vera,

    Thank you for the question.

    The drop-down menu in QuckAccessToolbar is created dynamically when the menu is displayed for the first time. You can remove items only after the popup has been created. You could use the RadToolStripOverFlowButtonElement DropDownOpened event to do that. 

    Please review the code block provided below as reference:

    private void Form1_Load(object sender, EventArgs e)  
    {  
        RadToolStripOverFlowButtonElement quickAccessButton = (RadToolStripOverFlowButtonElement)this.radRibbonBar1.RootElement.Children[0].Children[0].Children[0].Children[1].Children[1]);  
        quickAccessButton.DropDownOpened += new EventHandler(quickAccessButton_DropDownOpened);  
    }  
     
    void quickAccessButton_DropDownOpened(object sender, EventArgs e)  
    {  
        HideQuickAccessDropDownItems();  
    }  
     
    private void HideQuickAccessDropDownItems()  
    {  
        RadDropDownMenu quickAccessMenu =   
            ((RadToolStripOverFlowButtonElement)this.radRibbonBar1.RootElement.Children[0].Children[0].Children[0].Children[1].Children[1]).DropDownMenu;  
     
        foreach (RadItem item in quickAccessMenu.Items)  
        {  
            if ((item.Text != "Minimize the Ribbon") && (item.Text != "Maximize the Ribbon"))  
            {  
                item.Visibility = ElementVisibility.Collapsed;  
            }  
        }  

    I hope this was helpful. Do not hesitate to contact me again if you need additional assistance.

    Kind regards,
    Martin Vasilev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Vera
    Vera avatar
    2 posts
    Member since:
    Feb 2008

    Posted 14 Apr 2008 Link to this post

    Thank you so much Martin! That works perfectly!

    Viv
Back to Top