ClassRadMaskedEditBoxElement
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
RadMaskedEditBoxElement()
Initializes a new instance of the RadMaskedEditBoxElement class with no mask applied by default.
Declaration
public RadMaskedEditBoxElement()
Properties
AllowPromptAsInput
Gets or sets a value indicating whether prompt characters are allowed as valid input by the user.
ContextMenu
Gets or sets the context menu for the RadMaskedEditBoxElement class.
Declaration
[Browsable(false)]
public RadContextMenu ContextMenu { get; set; }
Property Value
ContextMenuEnabled
This property is not relevant for this class.
Declaration
[Browsable(false)]
public bool ContextMenuEnabled { get; set; }
Property Value
Culture
Gets or sets the culture that determines the value of the localizable separators and placeholders in the input mask.
Declaration
public CultureInfo Culture { get; set; }
Property Value
A CultureInfo containing the culture information associated with the input mask.
EnableArrowKeys
This property is not relevant for this class.
Declaration
[Browsable(false)]
public bool EnableArrowKeys { get; set; }
Property Value
EnableClickSelectionStart
Gets or sets a value indicating whether the selection functionality on mouse click is enabled.
Declaration
public bool EnableClickSelectionStart { get; set; }
Property Value
EnableMouseWheel
This property is not relevant for this class.
Declaration
[Browsable(false)]
public bool EnableMouseWheel { get; set; }
Property Value
EnableNullValueInput
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.
Declaration
public virtual bool EnableNullValueInput { get; set; }
Property Value
HintPosition
Gets the result hint position for the last assignment to the Text property.
Declaration
[Browsable(false)]
public int HintPosition { get; }
Property Value
IncludePrompt
Gets or sets a value indicating whether prompt characters are displayed in the formatted output.
IsKeyBoard
This property is not relevant for this class.
Declaration
[Browsable(false)]
public bool IsKeyBoard { get; }
Property Value
Mask
Gets or sets the input mask to use for validating user input.
MaskType
Gets or sets the mask type.
Declaration
public virtual MaskType MaskType { get; set; }
Property Value
MaxTimeSpan
Gets or sets the maximum value for TimeSpan providers.
MinTimeSpan
Gets or sets the minimum value for TimeSpan providers.
PromptChar
Gets or sets the prompt character used to represent missing input positions in the mask.
Provider
This property is not relevant for this class.
Declaration
[Browsable(false)]
public IMaskProvider Provider { get; set; }
Property Value
ResultHint
Gets the result hint for the last assignment to the Text property.
Declaration
[Browsable(false)]
public MaskedTextResultHint ResultHint { get; }
Property Value
SelectionLengthOnMouseClick
Gets or sets the selection length that will be applied when EnableClickSelectionStart is enabled and a mouse click occurs.
Declaration
public int SelectionLengthOnMouseClick { get; set; }
Property Value
SelectionStartOnMouseClick
Gets or sets the selection start position that will be applied when EnableClickSelectionStart is enabled and a mouse click occurs.
Declaration
public int SelectionStartOnMouseClick { get; set; }
Property Value
Text
Gets or sets the text displayed in the control.
Declaration
public override string Text { get; set; }
Property Value
Overrides
TextMaskFormat
Gets or sets a value that determines whether literals and prompt characters are included in the formatted string.
Declaration
public MaskFormat TextMaskFormat { get; set; }
Property Value
One of the MaskFormat values. The default is IncludePromptAndLiterals.
UnmaskedText
Gets the unmasked copy of the text without formatting characters.
Declaration
[Browsable(false)]
public string UnmaskedText { get; }
Property Value
Value
Gets or sets the value of the RadMaskedEditBoxElement class.
Methods
CallValueChanged(EventArgs)
Raises the ValueChanged event when the value has been modified.
Declaration
protected virtual void CallValueChanged(EventArgs e)
Parameters
e
The event arguments
CallValueChanging(CancelEventArgs)
Raises the ValueChanging event when the value is about to be modified, allowing cancellation.
Declaration
protected virtual void CallValueChanging(CancelEventArgs e)
Parameters
e
The cancel event arguments
CreateMaskProvider()
Creates and configures the appropriate mask provider based on the current mask type, culture, and mask settings.
Declaration
protected virtual void CreateMaskProvider()
DisposeManagedResources()
Disposes of the managed resources used by the masked edit box element.
Declaration
protected override void DisposeManagedResources()
Overrides
Down()
Decrements the value at the current cursor position based on the mask type.
Declaration
public void Down()
ExcludeLiterals()
Returns the text value with literal characters excluded but prompt characters included.
Declaration
protected virtual string ExcludeLiterals()
Returns
The text value without literal characters
ExcludePrompt()
Returns the text value with prompt characters excluded but literal characters included.
Declaration
protected virtual string ExcludePrompt()
Returns
The text value without prompt characters
ExcludePromptAndLiterals()
Returns the text value with both prompt characters and literal characters excluded.
Declaration
protected virtual string ExcludePromptAndLiterals()
Returns
The text value without prompt and literal characters
Format(string, string)
Formats the specified text using the specified mask.
Format(string, string, char)
Formats the specified text using the specified mask and prompt character.
Format(string, string, char, CultureInfo)
Formats the specified text using the specified mask, prompt character, and culture information.
Declaration
public static string Format(string mask, string text, char promptChar, CultureInfo culture)
Parameters
mask
The mask to use for formatting
text
The text to format
promptChar
The prompt character to use for missing characters
culture
The culture information to use for formatting
Returns
The formatted text string
Format(string, string, char, CultureInfo, out MaskedTextResultHint, out int)
Formats the specified text using the specified mask, prompt character, and culture information, returning detailed result information.
Declaration
public static string Format(string mask, string text, char promptChar, CultureInfo culture, out MaskedTextResultHint hint, out int hintPosition)
Parameters
mask
The mask to use for formatting
text
The text to format
promptChar
The prompt character to use for missing characters
culture
The culture information to use for formatting
hint
Returns the result of the formatting operation
hintPosition
Returns the position related to the result hint
Returns
The formatted text string
GetClipboardText()
Retrieves text content from the system clipboard, supporting both Unicode and standard text formats.
Declaration
public static string GetClipboardText()
Returns
The clipboard text content, or an empty string if no text is available
GetFormat(string, CultureInfo)
Determines the numeric format type based on a format string and culture.
Declaration
public static NumericCharacterTextBoxProvider.RadNumericMaskFormatType GetFormat(string formatString, CultureInfo culture)
Parameters
formatString
The format string to analyze
culture
The culture information
Returns
NumericCharacterTextBoxProvider.RadNumericMaskFormatType
The corresponding numeric format type
HandleKeyPress(KeyPressEventArgs)
Handles key press events for clipboard operations and other special key combinations.
Declaration
public virtual void HandleKeyPress(KeyPressEventArgs e)
Parameters
e
The key press event arguments
OnClearButtonClick()
Handles the clear button click event by setting the value to null if null value input is enabled, or validating an empty string otherwise.
Declaration
protected override void OnClearButtonClick()
Overrides
OnMaskProviderCreated()
Raises the MaskProviderCreated event when a new mask provider has been created.
Declaration
protected virtual void OnMaskProviderCreated()
OnMouseDown(MouseEventArgs)
Handles mouse down events to set selection position and length when click selection start is enabled.
Declaration
protected override void OnMouseDown(MouseEventArgs e)
Parameters
e
The mouse event arguments
Overrides
RemoveNumberFormats(string)
Removes number formatting characters and symbols based on the current culture and numeric provider type.
SetCultureCore(CultureInfo)
Sets the culture for the masked edit box and recreates the mask provider with the new culture settings.
Declaration
protected virtual void SetCultureCore(CultureInfo value)
Parameters
value
The new culture to apply
TextBoxItem_MouseWheel(object, MouseEventArgs)
Handles mouse wheel events to increment or decrement values when mouse wheel is enabled and the control is not read-only.
Declaration
protected virtual void TextBoxItem_MouseWheel(object sender, MouseEventArgs e)
Parameters
sender
The event source
e
The mouse event arguments
Up()
Increments the value at the current cursor position based on the mask type.
Declaration
public void Up()
Validate(string)
Validates the specified value against the current mask and updates the display.
Declaration
public virtual void Validate(string value)
Parameters
value
The value to validate
Events
MaskProviderCreated
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.
Declaration
public event EventHandler MaskProviderCreated
Event Value
ValueChanged
Occurs when the editing value has been changed.
ValueChanging
Occurs when the editing value is changing and allows cancellation of the change.
Declaration
public event CancelEventHandler ValueChanging
Event Value