views:

1907

answers:

7

I have a WinForms application with a view where the user selects a single time span from a list of predefined time spans in a ComboBox, with it's DropDownStyle property set to DropDownList.

Now, the requirements have changed. The users are going to need the ability to make multiple selections from the list of time spans.

Is it possible to make multiple selections in a ComboBox? How do you present those choices when the ComboBox is collapsed? Don't forget the usability aspect.

Does some other control exist (built in or 3rd party, preferrably a drop down of some sort) that can provide for my users needs?

Update: Misleading title...

+3  A: 

Even if it is possible, I would suggest changing the input type. When I see a drop-down box, I think that I must pick one. The ability to (and even how to) pick multiple options might elude your user. A standard list box might be more appropriate, from a usability standpoint.

Thomas Owens
Absolutely. Problem is, I have limited vertical space...
Lette
+1  A: 

I dont think its possible out of the box without writing a bunch of custom code.

I would have to agree with Thomas, except would even suggest possibly using a checkedlistbox, as imo, it is more clear that multiple selections are to be made than a list box (and you dont need help text saying to multi select, use ctrl)

mattlant
Agreed. And writing a bunch of custom code... not gonna happen.
Lette
A: 

The Windows.Forms.ComboBox cannot provide multi-selection.

Phil Wright
A: 

I would use the CheckedListBox instead. It visualizes the multiple selection and you are able to select multiple entries. Here is the Microsoft link to the class.

Mil
A CheckedComboBox would be even better, but alas...
Lette
+2  A: 

I agree with @Thomas Owens on the usability aspect. If you are selecting multiple items then the user should be able to see all of the items that are selected. Maybe a checked list box will work for this.

If you still have you heart set on using a drop down type of control take a look at the DevExpress editors toolkit. I have just looked through their demo and there is a control called a PopupContainerEdit that will allow you to pop up a list of items with checkboxes. When the popup collapses you could always show the items as a coma delimited list. (though this may be unusable if the list is longer than the box)

FryHard
Thanks, I'll take a look at the PopupContainerEdit.
Lette
Not the answer I was looking for, but still the best one. Thanks for the link.
Lette
A: 

You are looking for ListBox.

Vivek
No, I'm not. Hasn't got enough vertical space...
Lette
A: 

Hi, hope this will help you : http://www.codeproject.com/KB/combobox/checkedcombobox.aspx

Regards, Mathi

Mathiyazhagan