The problem
The ComboBox is fine for picking one string from a short list. It runs out as soon as an item needs more than its name: a customer with a city and an account number, a product with its price, a country with its flag. Its list has one column, so the usual workaround is DrawMode.OwnerDrawFixed and a DrawItem handler that paints the columns, with no column headers and widths that your code has to work out.
More gaps show up as the lists grow. Categories cannot be grouped under expandable parents. Typing finds items only by the start of their text, never by a word inside it, and the list cannot be narrowed to the matching items. The dropdown has a fixed width that your code sets, and a DropDownList combo box shows the selected item as a single string.
SftBox/NET 3.0 is a combo box for Windows Forms, written entirely in C#, whose list is a multi-column tree, with these features built in.
Feature comparison
| Feature | ComboBox | Owner-drawn ComboBox | SftBox/NET 3.0 |
|---|---|---|---|
| Columns in the list | No, one column of text | Painted by your DrawItem code, without headers | Columns with headers and footers, grid lines and sorting |
| Hierarchy | No | Indentation painted by your code, nothing to expand or collapse | Expand/collapse buttons, tree lines and item images |
| Images, check boxes, progress bars | No | Painted by your code, with no mouse handling | Built in, in any cell, with buttons and radio buttons too |
| Searching as the user types | By the start of the text | By the start of the text | Prefix, exact, auto-complete, contains, or a filter that shows only the matching items with their parent items, in any column |
| The selected item in a DropDownList | Its text | Painted by your code | The item as the list shows it, with all its columns and images |
| Dropdown size | A width your code sets | A width your code sets | As wide as all columns, aligned with either edge, above or below the control, resizable by the user |
| Clear button | No | No | Yes |
| Data binding | DataSource, DisplayMember, ValueMember | DataSource, DisplayMember, ValueMember | The same, with a column for each data member and a hierarchy from keys or child lists |
| Font lists | Names added by your code, in the control's font | Painted by your code | Each name in its own font, plus lists of styles and sizes |
What the code looks like
If you know the ComboBox, much of SftBox/NET will look familiar: DataSource, DisplayMember, ValueMember, SelectedValue, Text and DroppedDown. It is not a drop-in replacement, though: the list is a tree with items, columns and cells, and the selection is an item rather than an index. This binds a combo box to a table of countries with two columns, filters the list as the user types, shows a placeholder while nothing is selected, and binds the selected country to an order as a lookup field:
sftBox1.Columns.Count = 2;
sftBox1.Columns[0].DataMember = "Name";
sftBox1.Columns[1].DataMember = "Capital";
sftBox1.DropDownWidthMode = DropDownWidthModeEnum.Optimal;
sftBox1.DisplayMember = "Name";
sftBox1.ValueMember = "Id";
sftBox1.DataSource = countries;
sftBox1.SearchMode = SearchModeEnum.Filter;
sftBox1.Placeholder = "Select a country";
sftBox1.ShowClearButton = true;
sftBox1.DataBindings.Add("SelectedValue", order, "CountryId",
false, DataSourceUpdateMode.OnPropertyChanged);
You can also skip most of the code: the control is placed from the Visual Studio toolbox, and its property pages set up the combo box and its list visually. The documentation lists where each ComboBox function is found in SftBox/NET.
Modern Windows
SftBox/NET 3.0 runs in .NET Framework 4.7 (or later) and .NET 10 (or later) applications, with the same API and Visual Studio designer support in both. Set one property and the combo box and its dropdown follow the Windows light/dark setting. The control scales with the DPI of the monitor showing it, honors the Windows contrast themes and has built-in UI Automation support for Narrator, NVDA, JAWS and other screen readers.
When the ComboBox is enough
If a form needs one string picked from a short, flat list, the ComboBox is fine, and it is free. SftBox/NET earns its place when items have more than a name, when lists are long enough that users search them, when choices fall into groups, or when the selected item should look the way it looks in the list.
Try it
The free trial includes the working control and the C# and VB.NET samples. Test it in your own forms before you buy. A license is royalty-free and includes one year of support and upgrades.
