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

RadTextBox ReadOnly Theme

1 Answer 259 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 09 Feb 2017, 08:26 PM

I have a situation where I'd like to theme the RadTextBox differently when the text box is set to ReadOnly = True. I currently have a custom theme for the application that applies the general theme I want which is basically that when a text box is editable, it's the standard white background with black text, when it's disabled, it's a dark gray background with black text. However, I have a form with a number of text boxes on it where I need some of the capabilities you get with an enabled text box (copy-able, scroll-able, a border, etc.) that you don't get with, say, a label but yet I don't want the user to actually be able to change anything and I'm not willing to change the basic look of the text box when it's disabled as that's useful elsewhere in the application.

Setting the text box to ReadOnly functionally works perfectly from a functional viewpoint, but I'd like a visual indication to the user that the text box is not one that they can edit. Now, I understand that this could be done a number of ways - I could, for example, easily write code that sets the background and foreground colors subtly different. Writing code to do this basically defeats the idea of the theme however. Ideally, I was hoping that in the Element States I could add a ReadOnly state and be done with it, but when I click on the Add button in the Available States dialog, it doesn't appear to be an option.

So, my question is: am I missing something here? Is there some way to add to the Available States list? If not, is there a way I could maybe create a repository item that I could then apply to the control directly in code, basically manually themeing the control? This last way is not much different than just coding the colors myself, but at least the settings are in the theme and the other devs here don't have to worry about the exact colors, so there's that - also, when we make additional themes just swapping out the theme file would adjust the colors as well. Any guidance you can give on this would be appreciated.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 10 Feb 2017, 11:50 AM
Hi Jay,

Thank you for writing.

There is no way to add additional states to the text box. The states are predefined in our code and there is no separate state for the read-only mode. The possible solution would be to create a separate theme and use it for the read-only textboxes. The following article shows how you can apply the different theme for a specific control: Using a Default Theme for the Entire Application.

I hope this information is useful. 

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Themes and Visual Style Builder
Asked by
Jay
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or