Class RadTextBoxElement
Represents a text box element that provides comprehensive text input functionality with advanced features including embedded labels, clear buttons, and animation capabilities. The RadTextBox class is a simple wrapper for the RadTextBoxElement class. All UI and logic functionality is implemented in the RadTextBoxElement class. RadTextBox class acts to transfer events to and from its corresponding RadTextBoxElement instance. The RadTextBoxElement may be nested in other telerik controls.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.UI.dll
Syntax
[ComVisible(false)]
public class RadTextBoxElement : RadEditorElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IComponent, IDisposable, IBindableComponent, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode
Constructors
RadTextBoxElement()
Initializes a new instance of the RadTextBoxElement class.
Declaration
public RadTextBoxElement()
RadTextBoxElement(RadTextBoxItem)
Initializes a new instance of the RadTextBoxElement class.
Declaration
public RadTextBoxElement(RadTextBoxItem textBoxItem)
Parameters
RadTextBoxItem
textBoxItem
The RadTextBoxItem instance to use as the underlying text input control. |
Fields
NullTextColorProperty
Identifies the NullTextColor dependency property that controls the color of prompt text displayed when the TextBox contains no text.
Declaration
public static RadProperty NullTextColorProperty
Field Value
RadProperty
|
Properties
Border
Gets the BorderPrimitive instance used for rendering the border around the text box.
Declaration
public BorderPrimitive Border { get; }
Property Value
BorderPrimitive
|
ButtonsStack
Gets the StackLayoutPanel instance that contains and arranges the clear button and other action buttons.
Declaration
public StackLayoutPanel ButtonsStack { get; }
Property Value
StackLayoutPanel
|
ClearButton
Gets the clear button element that allows users to quickly clear the text box content.
Declaration
public LightVisualButtonElement ClearButton { get; }
Property Value
LightVisualButtonElement
|
EmbeddedLabel
Gets the embedded label element that provides floating label functionality with animation support.
Declaration
public LightVisualElement EmbeddedLabel { get; }
Property Value
LightVisualElement
|
EmbeddedLabelAnimationSpeed
Gets or sets the animation speed for the embedded label transitions. The speed is an integer between 1 (animation disabled) and 10 (slowest animation) with a default value of 8.
Declaration
public int EmbeddedLabelAnimationSpeed { get; set; }
Property Value
System.Int32
|
EmbeddedLabelBorderOffset
Gets or sets the offset distance in pixels of the embedded label from the bottom border when the label is in the down position.
Declaration
public float EmbeddedLabelBorderOffset { get; set; }
Property Value
System.Single
|
EmbeddedLabelText
Gets or sets the text content displayed in the embedded label.
Declaration
public string EmbeddedLabelText { get; set; }
Property Value
System.String
|
Fill
Gets the FillPrimitive instance used for rendering the background of the text box.
Declaration
public FillPrimitive Fill { get; }
Property Value
FillPrimitive
|
NullTextColor
Gets or sets the color of the prompt text that is displayed when the TextBox contains no text.
Declaration
public Color NullTextColor { get; set; }
Property Value
System.Drawing.Color
|
PasswordChar
Gets or sets the character used to mask characters in a password text box control for security purposes.
Declaration
[RadDefaultValue("PasswordChar", typeof(RadTextBoxItem))]
public char PasswordChar { get; set; }
Property Value
System.Char
|
RepositionEmbeddedLabel
Gets or sets a value indicating whether the embedded label should automatically reposition itself when the text box is empty.
Declaration
public bool RepositionEmbeddedLabel { get; set; }
Property Value
System.Boolean
|
ShowBorder
Gets or sets a value indicating whether the border around the text box is visible or not.
Declaration
public bool ShowBorder { get; set; }
Property Value
System.Boolean
|
ShowClearButton
Gets or sets a value indicating whether the clear button is displayed to allow users to quickly clear the text box content.
Declaration
public bool ShowClearButton { get; set; }
Property Value
System.Boolean
|
ShowEmbeddedLabel
Gets or sets a value indicating whether the embedded label is visible and provides floating label functionality.
Declaration
public bool ShowEmbeddedLabel { get; set; }
Property Value
System.Boolean
|
TextAlign
Gets or sets the horizontal text alignment of the TextBoxItem.
Declaration
public HorizontalAlignment TextAlign { get; set; }
Property Value
System.Windows.Forms.HorizontalAlignment
|
TextBoxItem
Gets the underlying RadTextBoxItem instance that handles the core text input functionality.
Declaration
public RadTextBoxItem TextBoxItem { get; }
Property Value
RadTextBoxItem
|
UseGenericBorderPaint
Gets or sets a value indicating whether to use generic border painting to prevent clipping of characters due to font name or size particularities.
Declaration
[RadDescription("UseGenericBorderPaint", typeof(RadTextBoxItem))]
[RadDefaultValue("UseGenericBorderPaint", typeof(RadTextBoxItem))]
public bool UseGenericBorderPaint { get; set; }
Property Value
System.Boolean
|
Methods
ArrangeOverride(SizeF)
Arranges the child elements within the final size allocated to this element.
Declaration
protected override SizeF ArrangeOverride(SizeF finalSize)
Parameters
System.Drawing.SizeF
finalSize
The final area within which the element should arrange itself and its children. |
Returns
System.Drawing.SizeF
The actual size used by the element after arrangement. |
Overrides
CallTextChanged(EventArgs)
Raises the TextChanged event.
Declaration
protected virtual void CallTextChanged(EventArgs e)
Parameters
System.EventArgs
e
An EventArgs that contains the event data. |
CallTextChanging(TextChangingEventArgs)
Raises the TextChanging event.
Declaration
protected virtual void CallTextChanging(TextChangingEventArgs e)
Parameters
TextChangingEventArgs
e
A TextChangingEventArgs that contains the event data including old and new text values. |
CreateChildElements()
Creates the child elements including fill primitive, border primitive, buttons stack, clear button, and embedded label.
Declaration
protected override void CreateChildElements()
Overrides
CreateClearButton()
Creates and configures the clear button element with default padding settings.
Declaration
protected virtual LightVisualButtonElement CreateClearButton()
Returns
LightVisualButtonElement
A configured LightVisualButtonElement instance representing the clear button. |
CreateEmbeddedLabel()
Creates and configures the embedded label element with default properties for positioning and appearance.
Declaration
protected virtual LightVisualElement CreateEmbeddedLabel()
Returns
LightVisualElement
A configured LightVisualElement instance representing the embedded label. |
DisposeManagedResources()
Releases managed resources used by the RadTextBoxElement and unsubscribes from event handlers.
Declaration
protected override void DisposeManagedResources()
Overrides
Focus()
Sets input focus to the text box element.
Declaration
public override bool Focus()
Returns
System.Boolean
True if the input focus request was successful; otherwise, false. |
Overrides
InitializeFields()
Initializes the default field values and properties for the text box element including stretch behavior and embedded label border offset.
Declaration
protected override void InitializeFields()
Overrides
MeasureOverride(SizeF)
Measures the desired size of the element and its children based on the available space.
Declaration
protected override SizeF MeasureOverride(SizeF availableSize)
Parameters
System.Drawing.SizeF
availableSize
The available size that the parent element can allocate to this element. |
Returns
System.Drawing.SizeF
The desired size of the element including all children. |
Overrides
OnAcceptsTabChanged(EventArgs)
Raises the AcceptsTabChanged event.
Declaration
protected virtual void OnAcceptsTabChanged(EventArgs e)
Parameters
System.EventArgs
e
An EventArgs that contains the event data. |
OnBubbleEvent(RadElement, RoutedEventArgs)
Handles bubbled events from child elements including mouse events and multiline property changes.
Declaration
protected override void OnBubbleEvent(RadElement sender, RoutedEventArgs args)
Parameters
RadElement
sender
The source of the routed event. |
RoutedEventArgs
args
A RoutedEventArgs that contains the event data. |
Overrides
OnClearButtonClick()
Called when the clear button is clicked and clears the text content by setting it to an empty string.
Declaration
protected virtual void OnClearButtonClick()
OnHideSelectionChanged(EventArgs)
Raises the HideSelectionChanged event.
Declaration
protected virtual void OnHideSelectionChanged(EventArgs e)
Parameters
System.EventArgs
e
An EventArgs that contains the event data. |
OnLoaded()
Called when the element is loaded and initializes clear button visibility and focus event handling.
Declaration
protected override void OnLoaded()
Overrides
OnModifiedChanged(EventArgs)
Raises the ModifiedChanged event.
Declaration
protected virtual void OnModifiedChanged(EventArgs e)
Parameters
System.EventArgs
e
An EventArgs that contains the event data. |
OnMouseDown(MouseEventArgs)
Handles mouse down events by animating the embedded label up and setting focus to the text box control.
Declaration
protected override void OnMouseDown(MouseEventArgs e)
Parameters
System.Windows.Forms.MouseEventArgs
e
A MouseEventArgs that contains the event data. |
Overrides
OnMultilineChanged(EventArgs)
Raises the MultilineChanged event with the specified event arguments.
Declaration
protected virtual void OnMultilineChanged(EventArgs e)
Parameters
System.EventArgs
e
An EventArgs that contains the event data. |
OnReadOnlyChanged(EventArgs)
Raises the ReadOnlyChanged event with the specified event arguments.
Declaration
protected virtual void OnReadOnlyChanged(EventArgs e)
Parameters
System.EventArgs
e
An EventArgs that contains the event data. |
OnSelect()
Called when the element is selected and sets focus to the text box.
Declaration
protected override void OnSelect()
Overrides
OnTextAlignChanged(EventArgs)
Raises the TextAlignChanged event.
Declaration
protected virtual void OnTextAlignChanged(EventArgs e)
Parameters
System.EventArgs
e
An EventArgs that contains the event data. |
Events
AcceptsTabChanged
Occurs when the value of the AcceptsTab property has changed.
Declaration
public event EventHandler AcceptsTabChanged
Event Type
System.EventHandler
|
HideSelectionChanged
Occurs when the value of the HideSelection property has changed.
Declaration
public event EventHandler HideSelectionChanged
Event Type
System.EventHandler
|
ModifiedChanged
Occurs when the value of the Modified property has changed.
Declaration
public event EventHandler ModifiedChanged
Event Type
System.EventHandler
|
MultilineChanged
Occurs when the value of the Multiline property has changed.
Declaration
public event EventHandler MultilineChanged
Event Type
System.EventHandler
|
ReadOnlyChanged
Occurs when the ReadOnly property value has changed.
Declaration
public event EventHandler ReadOnlyChanged
Event Type
System.EventHandler
|
TextAlignChanged
Occurs when the value of the TextAlign property has changed.
Declaration
public event EventHandler TextAlignChanged
Event Type
System.EventHandler
|
TextChanged
Occurs after the text content has been changed.
Declaration
public event EventHandler TextChanged
Event Type
System.EventHandler
|
TextChanging
Occurs before the text content is changed, allowing validation or modification of the new text value.
Declaration
public event TextChangingEventHandler TextChanging
Event Type
TextChangingEventHandler
|