WPF ComboBoxEx

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

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

kick it on DotNetKicks.com

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Comments

October 22. 2009 10:38

trackback

WPF ComboBoxEx

You've been kicked (a good thing) - Trackback from DotNetKicks.com

DotNetKicks.com

December 11. 2009 17:53

trackback

Check some (runtime) characteristics of a dependency property

  It's pretty easy to inherit from an existing control in WPF. For instance, this great programmer

Jo-wen Mei

February 26. 2010 15:14

pingback

Pingback from jowenmei.com

Check some (runtime) characteristics of a dependency property «  Verbal Judo .Net

jowenmei.com

Comments are closed