Skip to main content

Microsoft Silverlight

ComboBox - Disabled and Collapsed item can still be selectedRSS Feed

(0)

Klinger
Klinger

Participant

Participant

1686 points

300 Posts

ComboBox - Disabled and Collapsed item can still be selected

A disabled combobox item can be selected if you use the arrows.

I tried setting IsEnabled=false and Visibility=Collapsed and still get the same behavior.

I find it to be a bit inconsistent.

If you can not select using the mouse you should not be able to select

using the keyboard either.

I am using Silverlight 3 ( I did not try it on SL 2).

mchlsync
mchlsync

Star

Star

14606 points

2,730 Posts

Silverlight MVP

Re: ComboBox - Disabled and Collapsed item can still be selected

 Why don't you remove those items from combobox instead of disabling them?

(If this has answered your question, please click on "Mark as Answer" on this post. Thank you!)

Regards,
Michael Sync
Silverlight MVP

Blog : http://michaelsync.net


Klinger
Klinger

Participant

Participant

1686 points

300 Posts

Re: ComboBox - Disabled and Collapsed item can still be selected

For most cases that's what I would do (filtering the source), but I have a specific situation where I don't want to.

The point is that the behavior is inconsistent, if you cannot select using the mouse, you

should not be able to select using the arrows.

leakybagel
leakybagel

Member

Member

20 points

10 Posts

Re: ComboBox - Disabled and Collapsed item can still be selected

The same functionality appears to exist with Silverlight 2.0 -- you can still select the item by using the keyboard.

It appears that the combobox items need to be declared as ComboBoxItems in order to disable one. I'm binding to a Dictionary<Enum, string> and can't figure out how to find and disable an item in the list.

http://leakybagel.com

praveenrangarajan
praveenr...

Member

Member

42 points

14 Posts

Re: ComboBox - Disabled and Collapsed item can still be selected

Why dont you trigger a selection_Changed, and look for the item's IsEnabled or Collapsed - exit out of the routine if true. My two cents worth solution :D.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities