3D-kreativ
3D-kreativ

Reputation: 9297

ComboBox like a button?

I have seen comboBoxes that looks like buttons with a small arrow to the right at the bottom, indicating that it's a drow down menu with several options. How is this done? Is there something I can change in the properties of the comboBox? Thanks!

EDIT: I'm using Windows Forms in Visual Studio 2010

Upvotes: 3

Views: 12413

Answers (4)

Sadaf
Sadaf

Reputation: 602

this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] 
{
    "Item 1",
    "Item 2",
    "Item 3",
    "Item 4",
    "Item 5"
});

Upvotes: 1

deadlydog
deadlydog

Reputation: 24404

I know the OP asked about a SplitButton for WinForms, but WinForms is not mentioned in the post's title so people looking for a Split Button to use with other technologies might end up here.

If you are looking for a Split Button in WPF then you can use the SplitButton provided free in the WPF Extended Toolkit.

Here's a little screen shot of how I used it in my WPF app.

enter image description here

Upvotes: 0

Aamir
Aamir

Reputation: 15566

This is called SplitButton and in .NET you have this available for toolbars but not for use in normal WinForms.

However, there are some alternatives such as:

  1. This one on Codeproject
  2. Another on CodeProject
  3. Another one here

Upvotes: 10

asdasdad
asdasdad

Reputation: 862

ComboBox.DropDownStyle = ComboBoxStyle.DropDownList try this

Upvotes: 0

Related Questions