OverflowButton

10 posts, 2 answers
  1. Joe Sugden
    Joe Sugden avatar
    52 posts
    Member since:
    Feb 2010

    Posted 09 Dec 2010 Link to this post

    Hello,

    We are wondering how to hide the "Add Or Remove Buttons" option when you click the overflow button on a strip of the command bar. We don't want to allow the user to be messing around with what buttons they see. Alternatively, if that option can not be hidden, how to make individual buttons not be present in the menu for show/hide. Note that we don't want to hide the OverlowButton as a whole cause if they make the form narrow they wont have a way to get to the buttons on the right that are now going to be hidden.

    See attached screenshot.

    Thanks in advance.
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 09 Dec 2010 Link to this post

    Hi Joe,

    If you want to get rid of the overflow menu, but still want to keep the overflow button, you can use the following code:
    AddHandler Me.CommandBarStripElement1.OverflowButton.OverflowMenuOpening, AddressOf OverflowMenu_Opening


    Private Sub OverflowMenu_Opening(ByVal sender As Object, ByVal e As CancelEventArgs)
        e.Cancel = True
    End Sub

    However, the only purpose of the overflow button is to show the overflow menu as far as I'm aware, and therefore it may be better to get rid of the overflow button alltogether in the following way
    Me.CommandBarStripElement1.OverflowButton.Visibility = ElementVisibility.Collapsed


    hope this helps but let me know if you need more information
    Richard
  3. Joe Sugden
    Joe Sugden avatar
    52 posts
    Member since:
    Feb 2010

    Posted 09 Dec 2010 Link to this post

    Hello Richard,

    What you are suggesting is disabling the whole overflow menu altogether, what we would like to do is keep the ability to show hidden buttons caused by the form being too narrow, and hide the "Add or Remove Buttons" option only, see new screenshot.

    Thanks
  4. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 09 Dec 2010 Link to this post

    Hi Joe,

    This isn't behaving how I was expecting, but here is what I have so far which may help, though it's not complete yet as it leaves the space for the menu text and removes the text. I'll keep looking for you

    AddHandler Me.CommandBarStripElement1.OverflowButton.DropDownMenu.DropDownOpened, AddressOf DropDown_Opened

    Private Sub DropDown_Opened(ByVal sender As Object, ByVal e As EventArgs)
        For Each item As Object In Me.CommandBarStripElement1.OverflowButton.DropDownMenu.Items
            If TypeOf item Is RadMenuItemBase Then
                If String.Equals("Add or Remove Buttons", CType(item, RadMenuItemBase).Text) Then
                    CType(item, RadMenuItemBase).Visibility = ElementVisibility.Collapsed
                End If
            End If
        Next
    End Sub

    richard
  5. Joe Sugden
    Joe Sugden avatar
    52 posts
    Member since:
    Feb 2010

    Posted 09 Dec 2010 Link to this post

    That helps, thanks!
  6. Answer
    Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 11 Dec 2010 Link to this post

    Hello Joe,

    Thank you for writing.

    You can force individual buttons not to be present in the menu for show/hide by setting their VisibleInOverflowMenu property to false. Hiding the "Add or remove buttons" menu item currently can be achieved only in the way that Richard posted. More extended customization options will be released with the upcoming service pack.

    Joe, I hope this will help you. If you have any further questions, do not hesitate to ask.

    Richard, thank you very much for the help. Your Telerik points have been updated.

    Greetings,
    Ivan Todorov
    the Telerik team
    Get started with RadControls for WinForms with numerous videos and detailed documentation.
  7. Manoj
    Manoj avatar
    5 posts
    Member since:
    Jan 2017

    Posted 16 Feb in reply to Richard Slade Link to this post

    I am using CommandBarStripElement, but I am not able to set the 'Text' property for it. I guess because of this, I am not able to see the desired structure in overflow button.
    Is this is a bug or am i missing something in it?
    UI with old control - Overflow button - old version.png -> (This is what we need to achieve with new version)
    UI with new control - Overflow button - new version.png

    Please suggest

    Thanks Manoj
  8. Manoj
    Manoj avatar
    5 posts
    Member since:
    Jan 2017

    Posted 16 Feb in reply to Manoj Link to this post

    Please reply
  9. Manoj
    Manoj avatar
    5 posts
    Member since:
    Jan 2017

    Posted 16 Feb Link to this post

    Please reply
  10. Dess
    Admin
    Dess avatar
    1998 posts

    Posted 17 Feb Link to this post

    Hello Manoj,

    Thank you for writing.  

    Here is a sample code snippet demonstrating how to change the text of the overflow menu items:
    private void AddRemoveButtonsMenuItem_DropDownOpened(object sender, EventArgs e)
    {
        for (int i = 0; i < this.commandBarStripElement1.OverflowButton.AddRemoveButtonsMenuItem.Items.Count; i++)
        {
            RadCommandBarOverflowMenuItem item = this.commandBarStripElement1.OverflowButton.AddRemoveButtonsMenuItem.Items[i] as RadCommandBarOverflowMenuItem;
            item.Text = "My text" + i;
        }
    }

    Additional information for the overflow button is available here: http://docs.telerik.com/devtools/winforms/commandbar/how-to/customize-the-overflow-button

    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.
Back to Top