This is a migrated thread and some comments may be shown as answers.

How do I set a style for a ReadOnly ComboBox

4 Answers 307 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Henrik Skak Pedersen
Top achievements
Rank 1
Henrik Skak Pedersen asked on 29 Nov 2012, 12:49 PM
Hi,

How do I set a style for a ReadOnly ComboBox? On a textbox you have a visual state called ReadOnly and you can set it like this:

<VisualState x:Name="ReadOnly">
.....
</VisualState>

I would like to set this both for the NonEditableComboBox and the EditableComboBox.

How can I accomplish this?

Thanks
Henrik Skak Pedersen 

4 Answers, 1 is accepted

Sort by
0
Masha
Telerik team
answered on 04 Dec 2012, 02:35 PM
Hello Henrik,

Setting the RadComboBox's IsReadOnly property to True will affect the RadComboBox only when it is editable and there is no visual element for it. It serves to  keep the editable look, but will prevent the user from typing. Did you mean you need to style the Disable look of RadComboBox? If it is what you want, you should modify  inside Editable and NonEditable control template of RadComboBox and particular inside VisualState x:Name="Disabled".

Let me know if it works for you.

Regards,
Maria
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Henrik Skak Pedersen
Top achievements
Rank 1
answered on 05 Dec 2012, 08:51 AM
Hello Maria,

Thank you for your reply. I know about the styling of the disabled box. But I would like to do this:
<VisualState x:Name="ReadOnly">

Just like the standard Silverlight TextBox.

Thanks
Henrik
0
Accepted
Masha
Telerik team
answered on 05 Dec 2012, 02:29 PM
Hello Henrik,

The easiest way to create a VisualState for IsReadOnly propert is to create a custom class which inherits RadComboBox and call ChangeVisualState when IsReadOnly property is set. I've created a sample project to demonstrate the approach. You could find it attached.

Hope it helps.

All the best,
Maria
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Henrik Skak Pedersen
Top achievements
Rank 1
answered on 06 Dec 2012, 11:53 AM
Perfect, thank you :-)
Tags
ComboBox
Asked by
Henrik Skak Pedersen
Top achievements
Rank 1
Answers by
Masha
Telerik team
Henrik Skak Pedersen
Top achievements
Rank 1
Share this question
or