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.
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
Initializes a new instance of the RadTextBoxElement class.
public RadTextBoxElement()
Initializes a new instance of the RadTextBoxElement class.
public RadTextBoxElement(RadTextBoxItem textBoxItem)
The RadTextBoxItem instance to use as the underlying text input control.
Fields
Identifies the NullTextColor dependency property that controls the color of prompt text displayed when the TextBox contains no text.
public static RadProperty NullTextColorProperty
Properties
Gets the BorderPrimitive instance used for rendering the border around the text box.
public BorderPrimitive Border { get; }
Gets the StackLayoutPanel instance that contains and arranges the clear button and other action buttons.
public StackLayoutPanel ButtonsStack { get; }
Gets the clear button element that allows users to quickly clear the text box content.
public LightVisualButtonElement ClearButton { get; }
Gets the embedded label element that provides floating label functionality with animation support.
public LightVisualElement EmbeddedLabel { get; }
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.
public int EmbeddedLabelAnimationSpeed { get; set; }
Gets or sets the offset distance in pixels of the embedded label from the bottom border when the label is in the down position.
public float EmbeddedLabelBorderOffset { get; set; }
Gets or sets the text content displayed in the embedded label.
public string EmbeddedLabelText { get; set; }
Gets the FillPrimitive instance used for rendering the background of the text box.
public FillPrimitive Fill { get; }
Gets or sets the color of the prompt text that is displayed when the TextBox contains no text.
public Color NullTextColor { get; set; }
Gets or sets the character used to mask characters in a password text box control for security purposes.
public char PasswordChar { get; set; }
Gets or sets a value indicating whether the embedded label should automatically reposition itself when the text box is empty.
public bool RepositionEmbeddedLabel { get; set; }
Gets or sets a value indicating whether the border around the text box is visible or not.
public bool ShowBorder { get; set; }
Gets or sets a value indicating whether the clear button is displayed to allow users to quickly clear the text box content.
public bool ShowClearButton { get; set; }
Gets or sets a value indicating whether the embedded label is visible and provides floating label functionality.
public bool ShowEmbeddedLabel { get; set; }
Gets or sets the horizontal text alignment of the TextBoxItem.
public HorizontalAlignment TextAlign { get; set; }
TextBoxItem
RadTextBoxItem
Gets the underlying RadTextBoxItem instance that handles the core text input functionality.
public RadTextBoxItem TextBoxItem { get; }
Gets or sets a value indicating whether to use generic border painting to prevent clipping of characters due to font name or size particularities.
public bool UseGenericBorderPaint { get; set; }
Methods
Arranges the child elements within the final size allocated to this element.
Raises the TextChanged event.
protected virtual void CallTextChanged(EventArgs e)
An EventArgs that contains the event data.
Raises the TextChanging event.
protected virtual void CallTextChanging(TextChangingEventArgs e)
A TextChangingEventArgs that contains the event data including old and new text values.
Creates the child elements including fill primitive, border primitive, buttons stack, clear button, and embedded label.
protected override void CreateChildElements()
Overrides:
Creates and configures the clear button element with default padding settings.
protected virtual LightVisualButtonElement CreateClearButton()
A configured LightVisualButtonElement instance representing the clear button.
Creates and configures the embedded label element with default properties for positioning and appearance.
protected virtual LightVisualElement CreateEmbeddedLabel()
A configured LightVisualElement instance representing the embedded label.
Releases managed resources used by the RadTextBoxElement and unsubscribes from event handlers.
protected override void DisposeManagedResources()
Overrides:
Sets input focus to the text box element.
public override bool Focus()
True if the input focus request was successful; otherwise, false.
Overrides:
Initializes the default field values and properties for the text box element including stretch behavior and embedded label border offset.
protected override void InitializeFields()
Overrides:
Measures the desired size of the element and its children based on the available space.
Raises the AcceptsTabChanged event.
protected virtual void OnAcceptsTabChanged(EventArgs e)
An EventArgs that contains the event data.
Handles bubbled events from child elements including mouse events and multiline property changes.
protected override void OnBubbleEvent(RadElement sender, RoutedEventArgs args)
The source of the routed event.
argsRoutedEventArgsA RoutedEventArgs that contains the event data.
Overrides:
Called when the clear button is clicked and clears the text content by setting it to an empty string.
protected virtual void OnClearButtonClick()
Raises the HideSelectionChanged event.
protected virtual void OnHideSelectionChanged(EventArgs e)
An EventArgs that contains the event data.
Called when the element is loaded and initializes clear button visibility and focus event handling.
protected override void OnLoaded()
Overrides:
Raises the ModifiedChanged event.
protected virtual void OnModifiedChanged(EventArgs e)
An EventArgs that contains the event data.
Handles mouse down events by animating the embedded label up and setting focus to the text box control.
protected override void OnMouseDown(MouseEventArgs e)
A MouseEventArgs that contains the event data.
Overrides:
Raises the MultilineChanged event with the specified event arguments.
protected virtual void OnMultilineChanged(EventArgs e)
An EventArgs that contains the event data.
Raises the ReadOnlyChanged event with the specified event arguments.
protected virtual void OnReadOnlyChanged(EventArgs e)
An EventArgs that contains the event data.
Called when the element is selected and sets focus to the text box.
protected override void OnSelect()
Overrides:
Raises the TextAlignChanged event.
protected virtual void OnTextAlignChanged(EventArgs e)
An EventArgs that contains the event data.
Events
Occurs when the value of the AcceptsTab property has changed.
[Browsable(true)]
public event EventHandler AcceptsTabChanged
Occurs when the value of the HideSelection property has changed.
[Browsable(true)]
public event EventHandler HideSelectionChanged
Occurs when the value of the Modified property has changed.
[Browsable(true)]
public event EventHandler ModifiedChanged
Occurs when the value of the Multiline property has changed.
[Browsable(true)]
public event EventHandler MultilineChanged
Occurs when the ReadOnly property value has changed.
[Browsable(true)]
public event EventHandler ReadOnlyChanged
Occurs when the value of the TextAlign property has changed.
[Browsable(true)]
public event EventHandler TextAlignChanged
Occurs after the text content has been changed.
[Browsable(true)]
public event EventHandler TextChanged
Occurs before the text content is changed, allowing validation or modification of the new text value.
[Browsable(true)]
public event TextChangingEventHandler TextChanging