OverflowButton

6 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. UI for WinForms is Visual Studio 2017 Ready
  4. 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
  5. 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
  6. Joe Sugden
    Joe Sugden avatar
    52 posts
    Member since:
    Feb 2010

    Posted 09 Dec 2010 Link to this post

    That helps, thanks!
  7. 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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready