View Full Version : How to disable ComboBox item?

6 Dec 2012, 3:40 AM

How can one disable a ComboBox item so that it is not selectable?


Colin Alworth
6 Dec 2012, 1:49 PM
As a matter of UI you have to ask yourself first: Why show the user something they can never do? Should it even be in the list?

As a matter of preventing selection: Listen to the BeforeSelect event, and cancel it. This should stop the user from being able to clock on it to select it.

As a matter of styling: Draw this item differently than the others using a template - perhaps make the text gray, perhaps give it a different background, perhaps make it slightly transparent.

6 Dec 2012, 3:46 PM
Thanks for the reply.

Why the need for such feature?
To show to the user that the option is available but that it has been used up.

There should be native support for this as want to also gray-out the icon for the item.
As this is well supported by the HTML select box and widely used, I am surprised that it is not a default feature.

Can someone please post an example of a solution?

12 Dec 2017, 2:12 PM
I'm seconding spectdev and have an exact same case which I need it for. Please consider adding this feature!