New to Telerik UI for WinFormsStart a free 30-day trial

Properties

Updated over 6 months ago
PropertyDescription
ListElementGets the auto-complete list element.
UseSystemPasswordCharGets or sets a value indicating whether the text in view should appear as the default password character.
PasswordCharGets or sets the character used to mask characters of a password in a single-line
HideSelectionGets or sets a value indicating whether the selected text in the text box control remains highlighted when the element loses focus.
CaretIndexGets or sets the caret position.
SelectionLengthGets or sets the number of characters selected in the text box.
TextLengthThe length of the text.
MaxLengthGets or sets the maximum number of characters the user can type or paste into the text box element.
TextGets or sets the current text in the text box element.
NullTextGets or sets the prompt text that is displayed when the text box contains no text.
NullTextColorGets or sets the color of the null text.
TextAlignGets or sets how the text is horizontally aligned in the element.
LinesGives access to the lines collection
SelectedTextGets or sets a value indicating the currently selected text in the text box.
AcceptsTabGets or sets a value indicating whether pressing the TAB key in a multiline text box element types a TAB character in the element instead of moving the focus to the next element in the tab order.
AcceptsReturnGets or sets a value indicating whether pressing ENTER in a multiline TextBox control creates a new line of text in the control or activates the default button for the form.
MultilineGets or sets a value indicating whether this is a multiline text box.
WordWrapIndicates whether a multiline text box control automatically wraps words to the beginning of the next line when necessary.
SelectionColorGets or sets the color of the selection.
SelectionOpacityGets or sets the selection opacity.
IsReadOnlyGets or sets a value indicating whether text in the text box is read-only.
IsReadOnlyCaretVisibleGets or sets a value indicating whether the caret is visible in read only mode.
ShowClearButtonGets or sets a value indicating whether the clear button is shown.
ShowNullTextGets or sets a value indicating whether the null text will be shown when the control is focused and the text is empty.
ShowEmbeddedLabelGets or sets a value indicating whether the embedded label is shown. It is recommended to set AutoSize to true, when using the embedded label.
EmbeddedLabelTextGets or sets the text of the embedded label.

ShowClearButton

Since R1 2017 RadTextBoxControl can show a clear button when there is some text in the editor. This is controlled by the ShowClearButton property.

WinForms RadTextBoxControl ShowClearButton

NullText

RadTextBoxControl has a NullText property that is not shared by the standard Windows Forms text box. This property specifies what text to be displayed when the control has no Text value. By default, when the control receives focus, this text is automatically removed. This behavior can be controlled by the ShowNullText property. If it is set to true the NullText will be shown even when the text box is focused until you enter some text in the editor.

Embedded Labels

Since R2 2021 RadTextBoxControl supports embedded labels. The embedded label shows a text in the text box field usually to indicate what text should the user enter in the text box. When RadTextBoxControl gets focus the embedded label will go up, so the user can type in the text box field. The ShowEmbeddedLabel property controls whether the embedded label is shown. You can set the desired text by using the EmbeddedLabelText property.

Example 1: Setting the embedded label

C#
this.radTextBoxControl1.ShowEmbeddedLabel = true;
this.radTextBoxControl1.AutoSize = true;
this.radTextBoxControl1.EmbeddedLabelText = "First Name";        

WinForms RadTextBoxControl Embedded Label

In order the embedded label to be shown correctly it is neccessary to autosize the RadTextBoxControl by setting AutoSize=true or set an appropriate height.

RadTextBoxControlElement exposes the following useful properties related to embedded labels. You can access them through the TextBoxElement property:

  • EmbeddedLabel - Gets an instance of the corresponding embedded label.
  • RepositionEmbeddedLabel - Gets or set a value to indicate whether to reposition the embedded label, when text box is empty.
  • EmbeddedLabelAnimationSpeed - Gets or set the animation speed of the embedded label.

The speed is an integer between 1 and 10 (slowest) with default value 8.

As of R2 2021 the default Height for RadTextBoxControl is changed to 22px.

Events

EventDescription
SelectionChangingOccurs when text selection is changing.
SelectionChangedOccurs when text selection is changed.
TextChangingOccurs when the text is changing.
TextBlockFormattingUse this event to change the styles of the words.
CreateTextBlockOccurs when an instance of ITextBlock instance is created.
ContextMenuOpeningOccurs before the default context menu is opened.

See Also