Last Updated: 21 Mar 2018 14:58 by John
Dess | Tech Support Engineer, Principal
Created on: 16 Feb 2017 08:21
Category: Editors
Type: Bug Report
FIX. RadTextBox - cursor is not displayed and text is cut and not wrapped in TelerikMetro theme
To reproduce: please refer to the attached sample project and gif file.

Workaround: this.radTextBox1.MinimumSize = new System.Drawing.Size(0, 25);
Use RadTextBoxControl
Posted on: 21 Mar 2018 14:58
Unfortunately, the issue remains: changing the Theme breaks the display of the textboxes, and so I have to fix it. Instead of Telerik providing some mechanism to do so, you leave it to me, and that requires a lot of tedious, error-prone code. A Telerik solution (maybe call it a workaround) would simplify things because Telerik can implement an event or something in the base class. I purchased Telerik because I wanted the Theme capability, but now I need tedious, error-prone code to make it work right. Yuck. Meanwhile, my other important issue was ignored, and that's why I let my subscription lapse.
Posted on: 21 Mar 2018 14:09
Hello John,
We need to say that this case is about a textbox with Multiline property set to true. According to MSDN( a multiline text box allows you to display more than one line of text in the textbox control. The resizing behavior of Microsoft TextBox is the following: 
 - when the Multiline is set to true the text box will not automatically resize
 - when the Multiline is set to false the text box will automatically resize
RadTextBox hosts the standard.NET TextBox control, and this is why the behavior is exactly the same. This is the reason we have declined the issue. 
Posted on: 26 Feb 2018 15:39
I am not even a little surprised that this bug has been declined; fixing it would have made too much sense. Leaving it as is means users have to add a lot of tedious, error-prone code in order to allow end-users to switch Themes whereas a fix inside the component would be easy.
Posted on: 26 Feb 2018 10:42
This is not an issue. It's just that when the Multiline property of RadTextBox is set to true, the AutoSize is automatically changed to false. When the TextBox is measured it returns the default size, which is 100x20, but in TelerikMetro theme, the default size of editors is 24 pixels and the height is not enough for the caret to fit and this is why it is not visible.
The user needs to set the height(Size property) of the control.
Dess | Tech Support Engineer, Principal
Posted on: 19 Jun 2017 10:07
Hello John, 

Thank you for the provided feedback. It is greatly appreciated. Feel free to use your workaround either in the ThemeResolutionService.ApplicationThemeChanged event or the ThemeNameChanged event at control level.
Posted on: 15 Jun 2017 14:40
There are several reasons why the workarounds recommended in the original post don't work for me. 

Some background: I am using the RadTextBox wrapped in a UserControl that is used in at least a hundred places and the RadTextBox is customized in response to several properties of the UserControl.

Using a minimum size is impractical because the font size varies and I'd have to map an appropriate minimum size based on the font-size. My workaround does not require that mapping. It reacts to the RadTextBox's current font-size and produces the correct height.

I do not want to use the RadTextBoxControl because at the time I entered the comment above, RadTextBoxControl had a performance issue (very slow when loading a lot of text) and an appearance issue (sometimes does not render selected text properly). I have not verified that the RadTextBoxControl issues are still outstanding.
Dess | Tech Support Engineer, Principal
Posted on: 15 Jun 2017 13:00
Hello John,
Thank you for writing.

Could you please share why the provided workarounds don't suit your scenario? If your code snippet behaves according to your custom requirement, feel free to use it.

Thank you.
Posted on: 23 Feb 2017 14:36
I posted the support ticket that triggered this entry. The two workarounds above were not options for me. I added an extension method that I call to set the height, which works, but making sure to call it at the right time--such as when the user switches themes--is tedious.

public static void SetHeight(this RadTextBox textBox) {
   var fontHeight = textBox.Font.Height;
   var textBoxPadding = textBox.TextBoxElement.Padding.Size.Height;
   var borderThickness = textBox.TextBoxElement.Border.BorderThickness.Size.Height;
   var calculatedHeight = fontHeight + textBoxPadding + borderThickness;
   if (textBox.Height != calculatedHeight) {
      textBox.Height = calculatedHeight;