Hide/Remove Add or Remove Buttons

8 posts, 0 answers
  1. Taylor
    Taylor avatar
    17 posts
    Member since:
    Mar 2011

    Posted 08 Apr 2011 Link to this post


    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.
  2. Taylor
    Taylor avatar
    17 posts
    Member since:
    Mar 2011

    Posted 11 Apr 2011 Link to this post

    Nm, I found it as an element in the stripElement Children collection.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 13 Apr 2011 Link to this post

    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
  5. Kyle
    Kyle avatar
    1 posts
    Member since:
    Apr 2013

    Posted 17 Apr 2013 Link to this post

    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?
  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 22 Apr 2013 Link to this post

    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.
  7. suhas tj
    suhas tj avatar
    2 posts
    Member since:
    Jun 2012

    Posted 09 May 2014 Link to this post

    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
  8. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 09 May 2014 Link to this post

    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.
     
  9. suhas tj
    suhas tj avatar
    2 posts
    Member since:
    Jun 2012

    Posted 13 May 2014 in reply to Stefan Link to this post

    Hello Stefan,
    thanks a lot. that fixed my problem. :-)

    Regards,
    Suhas T J
Back to Top
UI for WinForms is Visual Studio 2017 Ready