ClassRadTextBoxElement
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.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
[ComVisible(false)]
public class RadTextBoxElement : RadEditorElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemRadEditorElementRadTextBoxElement
Derived Classes:
Implements:
Inherited Members
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
textBoxItem
RadTextBoxItem
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
Properties
Border
Gets the BorderPrimitive instance used for rendering the border around the text box.
ButtonsStack
Gets the StackLayoutPanel instance that contains and arranges the clear button and other action buttons.
Declaration
public StackLayoutPanel ButtonsStack { get; }
Property Value
ClearButton
Gets the clear button element that allows users to quickly clear the text box content.
Declaration
public LightVisualButtonElement ClearButton { get; }
Property Value
EmbeddedLabel
Gets the embedded label element that provides floating label functionality with animation support.
Declaration
public LightVisualElement EmbeddedLabel { get; }
Property Value
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
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
EmbeddedLabelText
Gets or sets the text content displayed in the embedded label.
Fill
Gets the FillPrimitive instance used for rendering the background of the text box.
NullTextColor
Gets or sets the color of the prompt text that is displayed when the TextBox contains no text.
PasswordChar
Gets or sets the character used to mask characters in a password text box control for security purposes.
RepositionEmbeddedLabel
Gets or sets a value indicating whether the embedded label should automatically reposition itself when the text box is empty.
ShowBorder
Gets or sets a value indicating whether the border around the text box is visible or not.
ShowClearButton
Gets or sets a value indicating whether the clear button is displayed to allow users to quickly clear the text box content.
ShowEmbeddedLabel
Gets or sets a value indicating whether the embedded label is visible and provides floating label functionality.
TextAlign
Gets or sets the horizontal text alignment of the TextBoxItem.
Declaration
public HorizontalAlignment TextAlign { get; set; }
Property Value
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.
Methods
ArrangeOverride(SizeF)
Arranges the child elements within the final size allocated to this element.
CallTextChanged(EventArgs)
Raises the TextChanged event.
Declaration
protected virtual void CallTextChanged(EventArgs e)
Parameters
e
An EventArgs that contains the event data.
CallTextChanging(TextChangingEventArgs)
Raises the TextChanging event.
Declaration
protected virtual void CallTextChanging(TextChangingEventArgs e)
Parameters
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
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
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
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.
OnAcceptsTabChanged(EventArgs)
Raises the AcceptsTabChanged event.
Declaration
protected virtual void OnAcceptsTabChanged(EventArgs e)
Parameters
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
sender
The source of the routed event.
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
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
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
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
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
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
e
An EventArgs that contains the event data.
Events
AcceptsTabChanged
Occurs when the value of the AcceptsTab property has changed.
Declaration
[Browsable(true)]
public event EventHandler AcceptsTabChanged
Event Value
HideSelectionChanged
Occurs when the value of the HideSelection property has changed.
Declaration
[Browsable(true)]
public event EventHandler HideSelectionChanged
Event Value
ModifiedChanged
Occurs when the value of the Modified property has changed.
Declaration
[Browsable(true)]
public event EventHandler ModifiedChanged
Event Value
MultilineChanged
Occurs when the value of the Multiline property has changed.
Declaration
[Browsable(true)]
public event EventHandler MultilineChanged
Event Value
ReadOnlyChanged
Occurs when the ReadOnly property value has changed.
Declaration
[Browsable(true)]
public event EventHandler ReadOnlyChanged
Event Value
TextAlignChanged
Occurs when the value of the TextAlign property has changed.
Declaration
[Browsable(true)]
public event EventHandler TextAlignChanged
Event Value
TextChanged
Occurs after the text content has been changed.
Declaration
[Browsable(true)]
public event EventHandler TextChanged
Event Value
TextChanging
Occurs before the text content is changed, allowing validation or modification of the new text value.
Declaration
[Browsable(true)]
public event TextChangingEventHandler TextChanging
Event Value