Some time ago, I needed a combobox in WPF to support an empty value (null), so the user was able to deselect or undo a selection. Unfortunately, this was not supported by the standard ComboBox class WPF offers.
Therefore, I decided to create my own combobox, with a “lot” of additional features that I think a combobox must support for a developer to be really useful. The attached ComboBoxEx class is the result, and it adds the following features to the standard ComboBox class:
- Automatically select the value if only one item is available in the items source;
- Support the MaxLength property when IsEditable property is enabled;
- Keep selected value selected when updating the items source;
- Disable the control when no items are in the items source;
- Support an empty item, which can be null, but also a default value that can be specified.
A full demo application of all features is included in the package.

comboboxex.zip (34.12 kb) [Downloads: 123]