This is a migrated thread and some comments may be shown as answers.

RadToolStripOverflowButtonElement

2 Answers 47 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Vera
Top achievements
Rank 1
Vera asked on 10 Apr 2008, 05:40 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Martin Vasilev
Telerik team
answered on 14 Apr 2008, 10:52 AM
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
0
Vera
Top achievements
Rank 1
answered on 14 Apr 2008, 05:15 PM
Thank you so much Martin! That works perfectly!

Viv
Tags
RibbonBar
Asked by
Vera
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Vera
Top achievements
Rank 1
Share this question
or