Thanks.
24 Answers, 1 is accepted


Thanks for contacting us. In order to change the BackColor of the RadTextBox you should use the Edit UI Elements dialog which you can open from the Smart Tag of the control while at design time.
Follow these steps in order to achieve the desired appearance:
1. Drop a RadTextBox control on a Form in Visual Studio.
2. Select the control and open its Smart Tag.
3. Open the Edit UI Elements dialog from the Smart Tag.
4. You see the hierarchy of elements that builds the Telerik RadTextBox control. Select the RadTextBoxItem node from the tree on the left and change its BackColor from the Property Grid on the right.
5. Select the FillPrimitive element from the tree on the left and change its BackColor property again from the grid on the right. You should note that the GradientStyle property of the FillPrimitive should be set to Solid

DirectCast(AM_RadTextBox_AM_Process.TextBoxElement.Children(1), FillPrimitive).BackColor = Color.Linen
DirectCast(AM_RadTextBox_AM_Process.GetChildAt(0).GetChildAt(0), RadTextBoxItem).BackColor = Color.Linen
Basically, the BackColor property that comes with the RadTextBox control is inherited from the base Control class that is part of the .NET Framework. By setting this property you change the background color of the control that serves as a surface for our RadTextBox to paint itself. As you may know, the Telerik controls are built upon the Telerik Presentation Framework which is very similar to the WPF architecture, i. e. the controls are built from primitives like FillPrimitive, BorderPrimitive, TextPrimitive etc. This enables the more flexible customization of the appearance of our product. The primitive hierarchy of the RadTextBox is painted upon the surface control and thus you cannot see the result of setting the BackColor property. This implementation enables the user to customize the RadTextBox by separately defining border properties, back color properties and text properties (by modifying the corresponding primitives) and thus creating stylish GUIs built from gradients, alpha blending and transformations.
However, the RadTextBox control is slightly different since it also uses the standard Windows Forms TextBox control, i.e. it wraps its functionality. Therefore, in order to set the background color of the RadTextBox control, you have to separately set the color for the FillPrimitive and the RadTextBoxItem (which is actually the standard text box control) and thus achieving the effect of defining a background color for the whole control. You can do this by using the Element Hierarchy Editor.
I hope this clarifies the reason why setting the BackColor property will not produce the expected result.
Regards,
Deyan
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.


This line below will set an inner border to the indicated color - but I can't figure out the object hierarchy to get to the inner textBox so I can set either the background or foreground color
radTextBox1.TextBoxElement.Fill.BackColor = Color.Yellow;
Could you supply a C# sample to change the foreground and background color for a radTextBox
In order to change the color of the text box part, you should add one more line to the line that you have found:
this.radTextBox1.TextBoxElement.TextBoxItem.BackColor = Color.Yellow;
this.radTextBox1.TextBoxElement.TextBoxItem.ForeColor = Color.Red;
In order to change the color of the border, you have to access the Border object:
this
.radTextBox1.TextBoxElement.Border.ForeColor = Color.Red;
As to the color of the text, you can changed it as shown below:
this
.radTextBox1.TextBoxElement.TextBoxItem.ForeColor = Color.Red;
In case you have doubts about the hierarchy of a RadControl, you can use our RadControlSpy tool which will help you in this task.
I hope this helps. Regards,
Nikolay
the Telerik team
Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.


Regards!
This would probably be the FillPrimitive of RadTextBoxElement. Here is the code needed to change the backcolor of the control to yellow, the border to red and the text to blue:
this
.radTextBox1.TextBoxElement.Fill.BackColor = Color.Yellow;
this
.radTextBox1.TextBoxElement.TextBoxItem.BackColor = Color.Yellow;
this
.radTextBox1.TextBoxElement.Border.ForeColor = Color.Red;
this
.radTextBox1.TextBoxElement.TextBoxItem.ForeColor = Color.Blue;
I hope this helps.
Greetings,
Stefan
the Telerik team

This forum concerns RadControls for WinForms, while your question seems to be related to RadControls for ASP.NET AJAX. Please address your question in the appropriate forum in order to get adequate assistance: http://www.telerik.com/community/forums/aspnet-ajax.aspx.
Regards,
Stefan
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>

I still don't understand the differences between fill primitives and textboxitems.backcolor
They seem to do the same job: set Radcontrol's background color. Why are there both anyway?
Thank you for writing.
The Telerik Presentation Framework (TPF) offers WPF-like features within classic Windows Forms applications. Note that a control is built up from a few simple types of elements. By working with these elements, you can customize any control on a very granular level.
In Q1 2016 SP1 (version 2016.1.216) we introduced some improvements of the Telerik Presentation Framework and now setting the RadTextBox.BackColor will apply the desired color without the necessity to specify the color for the inner elements:
this
.radTextBox1.BackColor = Color.Red;
I hope this information helps. Should you have further questions I would be glad to help.
Dess
Telerik

Here is how to add backcolor to radtextbox server-side, i mean within the tag itself.
<telerik:RadTextBox ID="txtAudit1" EnabledStyle-BackColor="Black" runat="server" Width="100%" CssClass="text_alignment_right" InputType="Number" ReadOnly="true">
Use the : EnabledStyle-BackColor="Black"
That's it.
Thank you for writing.
I would like to note that this forum is relevant for the Telerik UI for WinForms suite. Feel free to post your questions/replies regarding other products in the relevant forum: http://www.telerik.com/forums
Thank you for your understanding.
Regards,
Dess
Telerik by Progress

Hi. I'm trying to set focus color on a RadTextBoxControl.
I use radTextBoxControl.TextBoxElement.FocusBorderColor = Color.Red;
When textbox is clicked into, nothing happens. Setting BorderColor does work. Any help? Thanks.
Thank you for writing.
In order to use the TextBoxElement.FocusBorderColor it is necessary to set the EnableFocusBorderproperty to true:
this
.radTextBoxControl1.TextBoxElement.FocusBorderColor = Color.Blue;
this
.radTextBoxControl1.TextBoxElement.EnableFocusBorder =
true
;
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Progress Telerik

Thank you for writing back.
Indeed, only a bottom border is displayed as it is demonstrated in the referred help article: http://docs.telerik.com/devtools/winforms/telerik-presentation-framework/focus-border-and-ripple-animations. This is by design.
If you need a border around the entire control you can subscribe to the GotFocus event and change the border color, width and box style:
public
Form1()
{
InitializeComponent();
this
.radTextBoxControl1.GotFocus += radTextBoxControl1_GotFocus;
this
.radTextBoxControl1.LostFocus += radTextBoxControl1_LostFocus;
}
Color defaultBorderColor;
private
void
radTextBoxControl1_LostFocus(
object
sender, EventArgs e)
{
this
.radTextBoxControl1.TextBoxElement.BorderColor = defaultBorderColor ;
}
private
void
radTextBoxControl1_GotFocus(
object
sender, EventArgs e)
{
this
.radTextBoxControl1.TextBoxElement.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder;
defaultBorderColor =
this
.radTextBoxControl1.TextBoxElement.BorderColor;
this
.radTextBoxControl1.TextBoxElement.BorderColor = Color.Red ;
this
.radTextBoxControl1.TextBoxElement.BorderWidth = 1;
}
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik

Thank you for writing back.
Please refer to the attached sample project which result is illustrated in the attached gif file. If it is still not the desired look, it would be greatly appreciated if you can provide a screenshot of the exact goal that you are trying to achieve. Thus, we would be able to think about a suitable solution and assist you further. Thank you in advance.
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik

Thank you for writing back.
If you apply the Office2010Silver theme to the entire application it is necessary to set the TextBoxElement.BorderGradientStyle property to Solid in addition to the previously provided code snippet:
private
void
radTextBoxControl1_GotFocus(
object
sender, EventArgs e)
{
this
.radTextBoxControl1.TextBoxElement.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder;
defaultBorderColor =
this
.radTextBoxControl1.TextBoxElement.BorderColor;
this
.radTextBoxControl1.TextBoxElement.BorderColor = Color.Red ;
this
.radTextBoxControl1.TextBoxElement.BorderGradientStyle = GradientStyles.Solid;
this
.radTextBoxControl1.TextBoxElement.BorderWidth = 1;
}
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Progress Telerik