WPF ListBox vs ComboBox
A ComboBox is a combination of listbox and edit control. A simple combobox is just a listbox with an edit control at the top; you can select from the list or type. a combobox with style "dropdown" is the same, but the listbox doesn't show up until you click the dropdown glyph. You can dropdown and select or just type in the edit control. a combobox with dropdownlist style is similar, but you can only select from the list presented - you can't type in what you want in the edit control.
Basically, a combobox (non simple style) takes up a lot less screen realestate than a full-on listbox.
List Box :
Occupies more space but shows more than one value.
We can select multiple items.
we can use checkboxes with in the list box.
Combo Box:
Occupies less space but shows only one value for visibility
Multiple select is not possible
can't use checkboxes within combo boxes
Also have a look at http://devproconnections.com/aspnet/dropdownlist-listbox-and-combobox-whats-difference
Verbal Kint
Updated on June 22, 2022Comments
-
Verbal Kint almost 2 years
I'm working on an application with C# and WPF, in which I need to bind to a dictionary and display key-value pairs. How are ListBoxes different from ComboBoxes, and what are some possible advantages/disadvantages of using one over the other?
-
Verbal Kint almost 8 yearsGreat thanks! Now is there some compromise between the two? Say for example that I want to show all values, but I don't need the user to select anything. Just a basic control that binds to the dictionary
-
ViVi almost 8 yearsIf you don't want user to select anything then why do you need to do a listbox or combobox? It's basically used in cases where user can select a particular item and you can show some information regarding that selected item. If you don't want user to select an item, simply create a grid and display the data.
-
Verbal Kint almost 8 yearsGotcha, thanks! Although binding to a collection requires a datagrid as opposed to a run-of-the-mill grid
-
adminSoftDK almost 8 years@IDisposable multiple select is possible if you modify the template of the combobox.
-
ViVi almost 8 years@adminSoftDK : yes I agree to that. I was saying the basic difference. We could obviously define templates to change the look and behavior.