Skip to content

API Proposal: SplitButton and DropDownButton #5911

Description

@manfromarce

Is your feature request related to a problem? Please describe.
Native Win32 button has a BS_SPLITBUTTON style (MFC also had SplitButton) but this has long been missing in WinForms.
Alternatives for SplitButton currently are:

  • ToolStripSplitButton, but it can only be used inside a ToolStrip
  • using a button, setting Image / BackgroundImage to a down arrow and detecting the button portion where clicks occur
  • custom drawn button / custom control
    However, these solutions don't always work well.
    DropDownButton is quite easy to make because you just need to show a ContextMenuStrip when it's clicked, but since it's similar to SplitButton we could also implement it.

Describe the solution you'd like
We could implement SplitButton and DropDownButton in Windows Forms as new controls, or by adding a property (e.g. ButtonType) that changes the regular button appearance. Either way, there should be a DropDownItems property.
SplitButton would have a clickable area that doesn't show the drop-down menu and look like this:
image
while DropDownButton should not have the separator and look similar to this:
image
Drop-down menus could essentially be ContextMenuStrips and should support adding ToolStripMenuItems and ToolStripSeparators.

Will this feature affect UI controls?
Yes
- Will VS Designer need to support the feature? If yes, describe how you expect it to funсtion.
Yes, we could make the DropDownItems property editable with the same window that opens for MenuStrip and ContextMenuStrip's Items property:
image
- Will this feature need to be localized or be localizable?
Yes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestion(1) Early API idea and discussion, it is NOT ready for implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions