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

Changing border color of textbox and have it stay even when control is not in focus

1 Answer 128 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
LT
Top achievements
Rank 1
LT asked on 11 Aug 2020, 08:29 PM

Hello,

Already using back color of textbox for validation. I'm trying to set border color for a different flag on the same textbox, but this coloring goes back to default color when the control is not in focus using TextBoxElement.Border.ForeColor. Would like to have the backcolor stay all the time; which I could achieve with RootElement.BackColor, but this goes away when the control is in focus.

 

How can I achieve a static border color?

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Aug 2020, 08:59 AM

Hello, LT Nguyen,

If I understand your requirement correctly, you are trying to apply a specific border color for RadTextBox no matter  whether the control is focused or not.

Please refer to the following code snippet demonstrating how to achieve it:

        public RadForm1()
        {
            InitializeComponent();  

            this.radTextBox1.BackColor = Color.Yellow;
            this.radTextBox1.TextBoxElement.Border.ForeColor = Color.Red;
        }

The below screenshot illustrates that the border is preserved even though when the second RadTextBox is focused.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Tags
TextBox
Asked by
LT
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or