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

Metro theme - border on TextBox when IsReadonly = true

3 Answers 226 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrej
Top achievements
Rank 1
Andrej asked on 06 Aug 2012, 08:48 AM
Hi,

how do you set border for TextBox/PasswordBox when IsReadonly is set to true? By default the border is hidden until the field has focus. This is how I set Text/PasswordBox style in a resource file.

<Style TargetType="TextBox">
        <Setter Property="telerik:StyleManager.Theme" Value="Metro"/>
        <Setter Property="HorizontalContentAlignment" Value="Left" />
    </Style>
     
    <Style TargetType="PasswordBox">
        <Setter Property="telerik:StyleManager.Theme" Value="Metro"/>
        <Setter Property="HorizontalContentAlignment" Value="Left" />
    </Style>

Thanks

edit: I would like to have same look as when IsEnabled is set to False, with only difference that text can be selectable.

3 Answers, 1 is accepted

Sort by
0
Radoslaw
Top achievements
Rank 1
answered on 05 Sep 2012, 10:40 AM

I’ve got the same problem !

The textbox with IsReadOnly set to True, has no visible border. It looks ugly on white background page. It’s strange that radcombobox has border in IsReadOnly mode.

How to make textbox border visible in ReadOnly mode ?

0
Vanya Pavlova
Telerik team
answered on 10 Sep 2012, 07:18 AM
Hi Radoslaw,

 
Actually the behavior you mentioned is by design. When a control goes into ReadOnly state the Border of the root element is hidden. If you want to override this behavior you may predefine the template of the TextBox using Microsoft Expression Blend against MetroTheme and remove the logic you do not need.  
Can you verify how this works for you?    


Regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Radoslaw
Top achievements
Rank 1
answered on 11 Sep 2012, 08:20 AM
Hi Vanya !

Thank you for quick response. But my app has ability changing theme in runtime, so I would need something else to get border visible in ReadOnly mode.
I've tried also set IsEnabled to false insted of using ReadOnly mode, but in this case whole TextBox is hardly visible.
Do you have any idea, how to get TextBox ReadOnly (IsEnabled=False) behavior similar to RadCombobox in code behind ?
Tags
General Discussions
Asked by
Andrej
Top achievements
Rank 1
Answers by
Radoslaw
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or