Represents a RadMaskedEditBoxElement class that provides text input with validation and formatting through various mask types including numeric, date/time, standard character masks, email validation, and IP address input.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadMaskedEditBoxElement : RadTextBoxElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemRadEditorElementRadTextBoxElementRadMaskedEditBoxElement...
Derived Classes:
Implements:
Inherited Members
Constructors
Initializes a new instance of the RadMaskedEditBoxElement class with no mask applied by default.
public RadMaskedEditBoxElement()
Properties
Gets or sets a value indicating whether prompt characters are allowed as valid input by the user.
public bool AllowPromptAsInput { get; set; }
Gets or sets the context menu for the RadMaskedEditBoxElement class.
[Browsable(false)]
public RadContextMenu ContextMenu { get; set; }
This property is not relevant for this class.
[Browsable(false)]
public bool ContextMenuEnabled { get; set; }
Gets or sets the culture that determines the value of the localizable separators and placeholders in the input mask.
public CultureInfo Culture { get; set; }
A CultureInfo containing the culture information associated with the input mask.
This property is not relevant for this class.
[Browsable(false)]
public bool EnableArrowKeys { get; set; }
Gets or sets a value indicating whether the selection functionality on mouse click is enabled.
public bool EnableClickSelectionStart { get; set; }
This property is not relevant for this class.
[Browsable(false)]
public bool EnableMouseWheel { get; set; }
Gets or sets a value indicating whether end users can set the value to null using keyboard combinations. This can be achieved by pressing Ctrl + Del or Ctrl + 0 key combinations.
public virtual bool EnableNullValueInput { get; set; }
Gets the result hint position for the last assignment to the Text property.
[Browsable(false)]
public int HintPosition { get; }
Gets or sets a value indicating whether prompt characters are displayed in the formatted output.
public bool IncludePrompt { get; set; }
This property is not relevant for this class.
[Browsable(false)]
public bool IsKeyBoard { get; }
Gets or sets the input mask to use for validating user input.
public string Mask { get; set; }
Gets or sets the maximum date value for DateTime providers.
protected DateTime MaxDate { get; set; }
Gets or sets the maximum value for TimeSpan providers.
protected TimeSpan MaxTimeSpan { get; set; }
Gets or sets the minimum date value for DateTime providers.
protected DateTime MinDate { get; set; }
Gets or sets the minimum value for TimeSpan providers.
protected TimeSpan MinTimeSpan { get; set; }
Gets or sets the prompt character used to represent missing input positions in the mask.
public char PromptChar { get; set; }
This property is not relevant for this class.
[Browsable(false)]
public IMaskProvider Provider { get; set; }
Gets the result hint for the last assignment to the Text property.
[Browsable(false)]
public MaskedTextResultHint ResultHint { get; }
Gets or sets the selection length that will be applied when EnableClickSelectionStart is enabled and a mouse click occurs.
public int SelectionLengthOnMouseClick { get; set; }
Gets or sets the selection start position that will be applied when EnableClickSelectionStart is enabled and a mouse click occurs.
public int SelectionStartOnMouseClick { get; set; }
Gets or sets the text displayed in the control.
public override string Text { get; set; }
Overrides:
Gets or sets a value that determines whether literals and prompt characters are included in the formatted string.
public MaskFormat TextMaskFormat { get; set; }
One of the MaskFormat values. The default is IncludePromptAndLiterals.
Gets the unmasked copy of the text without formatting characters.
[Browsable(false)]
public string UnmaskedText { get; }
Gets or sets the value of the RadMaskedEditBoxElement class.
public object Value { get; set; }
Methods
Raises the ValueChanged event when the value has been modified.
Raises the ValueChanging event when the value is about to be modified, allowing cancellation.
protected virtual void CallValueChanging(CancelEventArgs e)
The cancel event arguments
Creates and configures the appropriate mask provider based on the current mask type, culture, and mask settings.
protected virtual void CreateMaskProvider()
Disposes of the managed resources used by the masked edit box element.
protected override void DisposeManagedResources()
Overrides:
Decrements the value at the current cursor position based on the mask type.
public void Down()
Returns the text value with literal characters excluded but prompt characters included.
protected virtual string ExcludeLiterals()
The text value without literal characters
Returns the text value with prompt characters excluded but literal characters included.
protected virtual string ExcludePrompt()
The text value without prompt characters
Returns the text value with both prompt characters and literal characters excluded.
protected virtual string ExcludePromptAndLiterals()
The text value without prompt and literal characters
Formats the specified text using the specified mask, prompt character, and culture information, returning detailed result information.
public static string Format(string mask, string text, char promptChar, CultureInfo culture, out MaskedTextResultHint hint, out int hintPosition)
The mask to use for formatting
textstringThe text to format
promptCharcharThe prompt character to use for missing characters
cultureCultureInfoThe culture information to use for formatting
hintMaskedTextResultHintReturns the result of the formatting operation
hintPositionintReturns the position related to the result hint
Returns:The formatted text string
Formats the specified text using the specified mask, prompt character, and culture information.
public static string Format(string mask, string text, char promptChar, CultureInfo culture)
The mask to use for formatting
textstringThe text to format
promptCharcharThe prompt character to use for missing characters
cultureCultureInfoThe culture information to use for formatting
Returns:The formatted text string
Formats the specified text using the specified mask and prompt character.
Retrieves text content from the system clipboard, supporting both Unicode and standard text formats.
public static string GetClipboardText()
The clipboard text content, or an empty string if no text is available
Determines the numeric format type based on a format string and culture.
public static NumericCharacterTextBoxProvider.RadNumericMaskFormatType GetFormat(string formatString, CultureInfo culture)
The format string to analyze
cultureCultureInfoThe culture information
Returns:NumericCharacterTextBoxProvider.RadNumericMaskFormatType
The corresponding numeric format type
Handles key press events for clipboard operations and other special key combinations.
public virtual void HandleKeyPress(KeyPressEventArgs e)
The key press event arguments
Handles the clear button click event by setting the value to null if null value input is enabled, or validating an empty string otherwise.
protected override void OnClearButtonClick()
Overrides:
Raises the MaskProviderCreated event when a new mask provider has been created.
protected virtual void OnMaskProviderCreated()
Handles mouse down events to set selection position and length when click selection start is enabled.
protected override void OnMouseDown(MouseEventArgs e)
The mouse event arguments
Overrides:
Sets the culture for the masked edit box and recreates the mask provider with the new culture settings.
protected virtual void SetCultureCore(CultureInfo value)
The new culture to apply
Handles mouse wheel events to increment or decrement values when mouse wheel is enabled and the control is not read-only.
protected virtual void TextBoxItem_MouseWheel(object sender, MouseEventArgs e)
The event source
eMouseEventArgsThe mouse event arguments
Increments the value at the current cursor position based on the mask type.
public void Up()
Validates the specified value against the current mask and updates the display.
Events
Occurs when the mask provider has been created. This event fires multiple times because the provider is recreated when properties like Mask, Culture, or MaskType change.
public event EventHandler MaskProviderCreated
Occurs when the editing value has been changed.
public event EventHandler ValueChanged
Occurs when the editing value is changing and allows cancellation of the change.
public event CancelEventHandler ValueChanging