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

Hide/Remove Add or Remove Buttons

9 Answers 1252 Views
CommandBar
This is a migrated thread and some comments may be shown as answers.
Taylor
Top achievements
Rank 1
Taylor asked on 08 Apr 2011, 09:58 PM

How do you remove/hide the Add or Remove Buttons/Customize item from the commandbar/strips? I didn't the Add or Remove Programs Button directly mentioned or named in the documentation so I am not sure if I am overlooking it.

9 Answers, 1 is accepted

Sort by
0
Taylor
Top achievements
Rank 1
answered on 11 Apr 2011, 11:06 AM
Nm, I found it as an element in the stripElement Children collection.
0
Stefan
Telerik team
answered on 13 Apr 2011, 04:42 PM
Hi Taylor,

You can remove the overflow button by setting its Visibility property. Here is a sample code that hides this button from one of the RadCommandBar strips:

commandBarStripElement1.OverflowButton.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;

I hope this helps. Should you have any other questions, do not hesitate to contact us.
 
Greetings,
Stefan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kyle
Top achievements
Rank 1
answered on 17 Apr 2013, 01:57 PM
I am having a similar issue in my application.  Every time I set the Add/Remove button or Customize buttons to not be visible or delete them they get re-created.  How do I disable or remove these buttons from my command bar?
0
Stefan
Telerik team
answered on 22 Apr 2013, 08:03 AM
Hello Kyle,

Once you use the code that I have provided for hiding the OverflowButton unless the visibility it changed, it should remain invisible. If this is not the case on your end, please get back to me with a sample where the issue can be reproduced, together with the exact steps that I need to follow in order to replicate it. I will investigate the reasons causing it and provide you with further support.

I am looking forward to your reply.

Kind regards,
Stefan
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
0
suhas tj
Top achievements
Rank 1
answered on 09 May 2014, 08:58 AM
With Respect to the above problem, 
it can be made invisible but i have a window which can be re sized. In that case, on overflow cases, i want to view these fields (Expectation as shown in Image 1). 
But when overflow is not there, it should hide that button but is shows an empty dropdown menu. (Expectation as shown in Image 2).

Any idea how to resolve these issues?

Regards,
Suhas T J
0
Stefan
Telerik team
answered on 09 May 2014, 01:15 PM
Hello Suhas,

Thank you for writing.

If I understand correctly, you want to show the overflow button only when needed and hide it if not needed. If so, you can use the ItemOverflowed and ItemOutOfOverflow events of CommandBarStripElement to do this. Here is a small sample:

protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
 
    AddCommandBar();
    radCommandBar1.Rows[0].Strips[0].ItemOverflowed += Form1_ItemOverflowed;
    radCommandBar1.Rows[0].Strips[0].ItemOutOfOverflow += Form1_ItemOutOfOverflow;
}
 
void Form1_ItemOutOfOverflow(object sender, EventArgs e)
{
    if (!radCommandBar1.Rows[0].Strips[0].HasOverflowedItems)
    {
        radCommandBar1.Rows[0].Strips[0].OverflowButton.Visibility = ElementVisibility.Collapsed;
    }
}
 
void Form1_ItemOverflowed(object sender, EventArgs e)
{
    radCommandBar1.Rows[0].Strips[0].OverflowButton.Visibility = ElementVisibility.Visible;
}

I hope this helps.

Regards,
Stefan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
suhas tj
Top achievements
Rank 1
answered on 13 May 2014, 09:31 AM
Hello Stefan,
thanks a lot. that fixed my problem. :-)

Regards,
Suhas T J
0
Manoj
Top achievements
Rank 1
answered on 15 Feb 2017, 05:25 AM

hi

i want to add one options in Add/Remove button from CommandBarStripElement  and in that report also i want to add three options like wise as below.

 

Add/Remove button--------->Report  in report add tools like----- new, save, save as, no text associated, reset toolbar etc

Add/Remove button---------> No text associated in that we add tools like lock, unlock etc

Add/Remove button--------->Customise

can you please suggest me solutions for this RadCommandBar Control.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 15 Feb 2017, 08:42 AM
Hello Manoj,

Thank you for writing.  

Each CommandBarStripElement has its own Overflow button. This button has a drop down, which contains "Add or Remove Buttons" menu item, "Customize..." menu item and RadMenuSeparatorItems items. You can add your own items in the "Add or Remove Buttons" menu item which performs the desired logic. Here is a sample code snippet demonstrating how to add a button and handle its Click event:
private void RadForm1_Load(object sender, EventArgs e)
{
    this.commandBarStripElement1.OverflowButton.AddRemoveButtonsMenuItem.DropDownOpened += AddRemoveButtonsMenuItem_DropDownOpened;
}
 
private void AddRemoveButtonsMenuItem_DropDownOpened(object sender, EventArgs e)
{
    RadMenuItem parentItem = sender as RadMenuItem;
    if (parentItem != null)
    {
        RadMenuItem myItem = new RadMenuItem();
        myItem.Text = "My Item";
        myItem.Click += myItem_Click;
        parentItem.Items.Add(myItem);
    }
}
 
private void myItem_Click(object sender, EventArgs e)
{
    Console.WriteLine("My Item is clicked");
}

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

Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
CommandBar
Asked by
Taylor
Top achievements
Rank 1
Answers by
Taylor
Top achievements
Rank 1
Stefan
Telerik team
Kyle
Top achievements
Rank 1
suhas tj
Top achievements
Rank 1
Manoj
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or