Metro theme - border on TextBox when IsReadonly = true

4 posts, 0 answers
  1. Andrej
    Andrej avatar
    3 posts
    Member since:
    May 2012

    Posted 06 Aug 2012 Link to this post


    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 TargetType="PasswordBox">
            <Setter Property="telerik:StyleManager.Theme" Value="Metro"/>
            <Setter Property="HorizontalContentAlignment" Value="Left" />


    edit: I would like to have same look as when IsEnabled is set to False, with only difference that text can be selectable.
  2. Radoslaw
    Radoslaw avatar
    15 posts
    Member since:
    Sep 2010

    Posted 05 Sep 2012 Link to this post

    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 ?

  3. Vanya Pavlova
    Vanya Pavlova avatar
    2019 posts

    Posted 10 Sep 2012 Link to this post

    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?    

    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  4. Radoslaw
    Radoslaw avatar
    15 posts
    Member since:
    Sep 2010

    Posted 11 Sep 2012 Link to this post

    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 ?
Back to Top