I want to disable listbox (not allow user to selected) but scrollable in Silverlight, how can I do that?
I want to disable listbox (not allow user to selected) but scrollable in Silverlight,
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
How about not using a ListBox. Despite it being the defacto means for displaying a list of items the true purpose of the
ListBoxis to select something from a list.A scrollable list can be delivered by styleing the
ItemsControllike this:-Now you apply this style to an
ItemsControl:-This is a scrollable list but with none of the selection semanitics of the ListBox. Note there are fewer intermediatory elements in the visual tree doing this way than fiddling around with the
ListBoxcontrol.Edit
In light of your comment there is an easy way to toggle the selection behaviour of a ListBox without disabling it. You disable the
ListBoxItemsit contains instead.In this case the ListBox starts of with disabled items. Scrolling however is still possible. But the items appear dimmed and there is no hover or selected highlighting going on.
The code below is able to toggle the “disabled” state on and off.