Is it possible, in Silverlight 4.0, to disable some ListBoxItems with XAML binding?
I have found some solutions in the web, but nothing that works with Silvelight 4.0
Thank you!
Pileggi
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.
Pant, pant! … At least I have found the solution but it was hard!
My solution is:
The conclusions are presonal and certainly some problems can be worked around, but…
In contrast to WPF, in Silverlight a DataTrigger (with its ChangePropertyAction) can’t stay elsewhere then inside a control inside the Template. And the property TargetObject of the ChangePropertyAction object, can be binded only linking the name of a control inside the template (TargetObject=”{Binding ElementName=g}” )
For this reason it’s impossible to bind the DataTrigger with the entire Item and to set it’s property IsEnabled but we need to work with every single control, and we need to reproduce the behaviour of the Item when it’s disabled. Particularly we can set the property IsHitTestVisible of the main Grid, that contains every other controls, to False, to avoid that it were responsible for the mouse inputs.
Finally in WPF it was quite more easy, but the important is to know what to do.