RadMaskedInputBase
Represents the base class for RadMaskedInput controls.
Definition
Namespace:Telerik.Windows.Controls
Assembly:Telerik.Windows.Controls.Input.dll
Syntax:
[Themable]
public abstract class RadMaskedInputBase : Control
Inheritance: objectRadMaskedInputBase
Derived Classes:
Constructors
Initializes a new instance of the RadMaskedInputBase class.
protected RadMaskedInputBase()
Fields
AcceptsReturnProperty
DependencyProperty
Identifies the AcceptsReturn dependency property.
public static readonly DependencyProperty AcceptsReturnProperty
Keyboard key code for the positive sign key on PC.
protected const int AddSignKey = 107
AllowInvalidValuesProperty
DependencyProperty
Identifies the AllowInvalidValues dependency property.
public static readonly DependencyProperty AllowInvalidValuesProperty
ClearButtonStyleProperty
DependencyProperty
Identifies the ClearButtonStyle dependency property.
public static readonly DependencyProperty ClearButtonStyleProperty
ClearCommandProperty
DependencyProperty
Identifies the ClearCommand dependency property.
public static readonly DependencyProperty ClearCommandProperty
CopyCommandProperty
DependencyProperty
Identifies the CopyCommand dependency property.
public static readonly DependencyProperty CopyCommandProperty
CultureProperty
DependencyProperty
Identifies the Culture dependency property.
public static readonly DependencyProperty CultureProperty
CutCommandProperty
DependencyProperty
Identifies the CutCommand dependency property.
public static readonly DependencyProperty CutCommandProperty
Keyboard key code for the comma symbol on PC.
protected const int DecimalCommaKey = 188
Keyboard key code for the decimal point symbol on PC.
protected const int DecimalPointKey = 190
DisplayErrorMessageProperty
DependencyProperty
Identifies the DisplayErrorMessage dependency property.
public static readonly DependencyProperty DisplayErrorMessageProperty
EmptyContentProperty
DependencyProperty
Identifies the EmptyContent dependency property.
public static readonly DependencyProperty EmptyContentProperty
EmptyContentTemplateProperty
DependencyProperty
Identifies the EmptyContentTemplate dependency property.
public static readonly DependencyProperty EmptyContentTemplateProperty
ErrorMessageProperty
DependencyProperty
Identifies the ErrorMessage dependency property.
public static readonly DependencyProperty ErrorMessageProperty
ErrorMessageTemplateProperty
DependencyProperty
Identifies the ErrorMessageTemplate dependency property.
public static readonly DependencyProperty ErrorMessageTemplateProperty
FormatStringProperty
DependencyProperty
Identifies the FormatString dependency property.
public static readonly DependencyProperty FormatStringProperty
InputBehaviorProperty
DependencyProperty
Identifies the InputBehavior dependency property.
public static readonly DependencyProperty InputBehaviorProperty
IsClearButtonVisibleProperty
DependencyProperty
Identifies the IsClearButtonVisible dependency property.
public static readonly DependencyProperty IsClearButtonVisibleProperty
IsLastPositionEditableProperty
DependencyProperty
Identifies the IsLastPositionEditable dependency property.
public static readonly DependencyProperty IsLastPositionEditableProperty
IsMaskValidProperty
DependencyProperty
Identifies the IsMaskValid dependency property.
public static readonly DependencyProperty IsMaskValidProperty
IsReadOnlyProperty
DependencyProperty
Identifies the IsReadOnly dependency property.
public static readonly DependencyProperty IsReadOnlyProperty
MaskProperty
DependencyProperty
Identifies the Mask dependency property.
public static readonly DependencyProperty MaskProperty
Keyboard key code for the negative sign key on PC.
protected const int NegativeSignKey = 189
OriginalValueProperty
DependencyProperty
Identifies the OriginalValue dependency property.
public static readonly DependencyProperty OriginalValueProperty
PasteCommandProperty
DependencyProperty
Identifies the PasteCommand dependency property.
public static readonly DependencyProperty PasteCommandProperty
PlaceholderProperty
DependencyProperty
Identifies the Placeholder dependency property.
public static readonly DependencyProperty PlaceholderProperty
SectionsNavigationModeProperty
DependencyProperty
Identifies the SectionsNavigationMode dependency property.
public static readonly DependencyProperty SectionsNavigationModeProperty
SelectionOnFocusProperty
DependencyProperty
Identifies the SelectionOnFocus dependency property.
public static readonly DependencyProperty SelectionOnFocusProperty
SpinModeProperty
DependencyProperty
Identifies the SpinMode dependency property.
public static readonly DependencyProperty SpinModeProperty
TextBoxStyleProperty
DependencyProperty
Identifies the TextBoxStyle dependency property.
public static readonly DependencyProperty TextBoxStyleProperty
TextModeProperty
DependencyProperty
Identifies the TextMode dependency property.
public static readonly DependencyProperty TextModeProperty
TextProperty
DependencyProperty
Gets the Text of the control.
public static readonly DependencyProperty TextProperty
UpdateValueEventProperty
DependencyProperty
Identifies the UpdateValueEvent dependency property.
public static readonly DependencyProperty UpdateValueEventProperty
ValueChangedEvent
RoutedEvent
Identifies the ValueChanged routed event.
public static readonly RoutedEvent ValueChangedEvent
ValueChangingEvent
RoutedEvent
Identifies the ValueChanging routed event.
public static readonly RoutedEvent ValueChangingEvent
ValueToTextConverterProperty
DependencyProperty
Identifies the ValueToTextConverter dependency property.
public static readonly DependencyProperty ValueToTextConverterProperty
Properties
Gets or sets a value indicating whether newline is accepted when the mask supports multiline.
public bool AcceptsReturn { get; set; }
Default value is false.
Gets the allowed DateTime tokens from the TokenLocator.
protected static string AllowedDateTimeTokens { get; }
Gets the allowed modifier tokens from the TokenLocator.
protected static string AllowedModifierTokens { get; }
Gets the allowed Numeric tokens from the TokenLocator.
protected static string AllowedNumericTokens { get; }
Gets or sets whether invalid values should be accepted as valid and set to the Value property.
public bool AllowInvalidValues { get; set; }
Represents a StringBuilder for performing string operations.
protected StringBuilder Builder { get; set; }
ClearButtonStyle
Style
Gets or sets the ClearButton style.
public Style ClearButtonStyle { get; set; }
Gets or sets the Clear command.
public DelegateCommand ClearCommand { get; set; }
Gets or sets the Copy command.
public DelegateCommand CopyCommand { get; set; }
Gets or sets the Culture.
public CultureInfo Culture { get; set; }
Default culture is "en-US".
Gets or sets the Cut command.
public DelegateCommand CutCommand { get; set; }
Gets the DisplayErrorMessage.
public string DisplayErrorMessage { get; }
A default error message will be shown unless the ErrorMessage property is not set.
Gets the ending position in the MaskedText that can be edited.
protected int EditableTextEnd { get; }
Gets the length of the editable section in the MaskedText.
protected int EditableTextLength { get; }
Gets the starting position in the MaskedText that can be edited.
protected int EditableTextStart { get; }
Gets or sets the Empty content.
public object EmptyContent { get; set; }
Default is an empty string.
EmptyContentTemplate
DataTemplate
Gets or sets the template of the EmptyContent.
public DataTemplate EmptyContentTemplate { get; set; }
Gets or sets the Error message.
public string ErrorMessage { get; set; }
ErrorMessageTemplate
DataTemplate
Gets or sets the template of the ErrorMessage.
public DataTemplate ErrorMessageTemplate { get; set; }
Contains the escaped positions of the MaskedText.
protected List<int> EscapedPositions { get; set; }
Gets or sets the formatting string used to format the Text value.
public string FormatString { get; set; }
Gets or sets the InputBehavior.
public InputBehavior InputBehavior { get; set; }
Default for numeric input should be Insert and for text and date input Replace.
Gets or sets the resolved InputBehavior.
protected virtual InputBehavior InputBehaviorResolved { get; }
Gets or sets whether the clear button is visible.
public bool IsClearButtonVisible { get; set; }
Gets or sets a value indicating whether this instance is last position editable.
public bool IsLastPositionEditable { get; set; }
True if this instance is last position editable; otherwise, false.
Gets or sets whether the control's mask is valid.
public bool IsMaskValid { get; }
Gets or sets whether the control is IsReadOnly.
public bool IsReadOnly { get; set; }
Gets or sets a value indicating whether the control is currently reverting its value.
protected bool IsRevertingValue { get; set; }
Gets or sets value indicating whether the control is one-way bound.
protected bool IsUsingOneWayBinding { get; }
Specifies whether the Value is being changed from the ValueInternal property.
protected bool IsValueChangingFromInternal { get; set; }
Specifies whether the ValueInternal is being synched from the Value property.
protected bool IsValueInternalSync { get; set; }
Contains the literal positions of the MaskedText.
protected List<int> LiteralPositions { get; set; }
The resolved masked text.
protected virtual string MaskedTextResolved { get; }
Gets or sets the resolved Mask.
protected string MaskResolved { get; set; }
Gets or sets the OriginalValue.
public object OriginalValue { get; set; }
Gets or sets the Paste command.
public DelegateCommand PasteCommand { get; set; }
Gets or sets the Placeholder.
[TypeConverter(typeof(CharConverter))]
public char Placeholder { get; set; }
Default placeholder is "_".
Gets or sets the sections navigation mode.
public SectionsNavigationMode SectionsNavigationMode { get; set; }
The sections navigation mode.
Gets or sets the Selection length.
public int SelectionLength { get; set; }
Gets or sets the SelectionOnFocus.
public SelectionOnFocus SelectionOnFocus { get; set; }
Controls the selection when focus is acquired. Default is Unchanged.
Gets or sets the Selection start.
public int SelectionStart { get; set; }
Contains the Separators of the Mask.
protected List<Separator> Separators { get; set; }
TextBoxStyle
Style
Gets the style of the TextBox.
public Style TextBoxStyle { get; set; }
Gets or sets the TextMode.
public TextMode TextMode { get; set; }
Controls the of format of the Text property. Default is MaskedText.
Gets or sets the UpdateValueEvent.
public UpdateValueEvent UpdateValueEvent { get; set; }
Controls when the Value is updated. Default is PropertyChanged.
Gets or sets a value whether the base class should apply base navigation.
protected virtual bool UseBaseNavigation { get; }
ValueToTextConverter
IValueConverter
Gets or sets the ValueToTextConverter.
public IValueConverter ValueToTextConverter { get; set; }
Methods
Spins the control.
Checks the value of a DependencyProperty for validation errors.
protected void CheckForDataValidationErrors(DependencyProperty prop, ref MaskValidationResult result)
The DependencyProperty to be checked.
resultMaskValidationResultReturns the validation information.
Clears the selection when no mask.
protected virtual void ClearSelectionNoMask()
The text has changed and the DisplayText has to be coerced against the Text.
Coerces the ValueInternal property from the Value property.
protected abstract void CoerceInternalValueFromStronglyTypeValueOverride()
Coerces the Value property from the ValueInternal property.
protected abstract void CoerceStronglyTypeValueFromInternalValueOverride()
The text has changed and the value has to be coerced against the text.
protected abstract bool CoerceValueOverride()
Returns true if the value can be coerced.
CopyBinding(Binding)
Binding
Clones a Binding and sets its Mode to TwoWay and UpdateSourceTrigger to Explicit.
protected static Binding CopyBinding(Binding bindingToCopy)
The binding to copy.
Returns:Binding
Returns the copied binding.
This is intended to be used in scenarios, where a one-way binding is used and value change notifications are still needed.
Finds the next available position in the MaskedTextResolved.
Finds the next position with separator.
protected virtual int FindNextSeparatorPosition(bool forward, int position, out Separator separator)
The direction of the search. True for forward, false for backward.
positionintThe position from which the search starts.
separatorSeparatorThe found separator.
Returns:Returns the position of the separator.
If no position is found, the method will return the EditableTextStart or EditableTextEnd depending on the direction.
Finds the previous available position when no mask.
Gets the offset from the right.
Gets the valid char for a position.
protected abstract string GetValidCharOverride(char character, ref int position, bool? forwardSpin, out bool isValid)
The character to be validated.
positionintPosition in the MaskedText to validate.
forwardSpinbool?True if a forward spin is applied, false for backward spin, null for no spin.
isValidboolTrue if the character is valid for this position.
Returns:Returns the result valid character for the specified position.
Handles the Back key when no mask.
protected virtual void HandleBackKeyNoMask()
Process the input when Backspace has been pressed and the mask in not "".
protected virtual void HandleBackKeyWithMask()
Process the input when Backspace has been pressed, the mask in not "" and there is a selection.
protected virtual void HandleBackKeyWithMaskSelected()
Called, when the Clear command is invoked.
protected virtual void HandleClearOverride()
Handles the Delete key when no mask.
protected virtual void HandleDeleteKeyNoMask()
Handles the Divide key.
protected virtual bool HandleDivideKey()
Returns a value indicating whether event should be handled or not.
Handles the Enter key.
protected virtual bool HandleEnterKey()
Returns a value indicating whether event should be handled or not.
Handles the left key down.
protected virtual void HandleLeftKey()
Handles the Multiply key.
protected virtual bool HandleMultiplyKey()
Returns a value indicating whether event should be handled or not.
Handles the paste operation.
protected virtual void HandlePaste()
Handles the Space key.
protected virtual bool HandleSpaceKey()
Returns a value indicating whether event should be handled or not.
Handles the spin when no mask.
Handles the Subtract key.
protected virtual bool HandleSubstractKey()
Returns a value indicating whether event should be handled or not.
Handles the tab key when no mask.
Inserts a new character when no mask.
Performs validation on the masked text.
protected virtual MaskValidationResult IsMaskValidOverride()
Returns validation result information.
Checks whether a specific character is a separator.
Checks whether a specified string is a separator.
Moves a group characters from the specified position to the left (forward) or right (backward) one position from the last Placeholder.
protected virtual void MoveCharactersInInsertBehaviorOverride(ref int position, char character, bool forward)
The position from which the move has to be done.
charactercharThe character input at this position.
forwardboolThe direction of the moving.
The method expects the text after the move to the set to the internal TextBox.
Handles ApplicationCommand.Cut execution.
protected void OnApplicationCut(object sender, ExecutedRoutedEventArgs e)
Handles ApplicationCommand.Paste execution.
protected void OnApplicationPaste(object sender, ExecutedRoutedEventArgs e)
public override void OnApplyTemplate()
OnCreateAutomationPeer()
AutomationPeer
Creates automation peer.
protected override AutomationPeer OnCreateAutomationPeer()
AutomationPeer
Returns the automation peer.
Executed when the Culture changes.
protected virtual void OnCultureChanged()
Called when control is loaded.
protected virtual void OnLoadedOverride(object sender, RoutedEventArgs e)
The sender.
eRoutedEventArgsThe RoutedEventArgs instance containing the event data.
When the mouse enters the control.
protected override void OnMouseEnter(MouseEventArgs e)
Mouse event args.
When the mouse leaves the control.
protected override void OnMouseLeave(MouseEventArgs e)
Mouse event args.
Handles the MouseWheel.
protected override void OnMouseWheel(MouseWheelEventArgs e)
Event args of the MouseWheel.
Invoked when an unhandled System.Windows.Input.Keyboard.PreviewKeyDown attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnPreviewKeyDown(KeyEventArgs e)
Executes when the focus is obtained.
protected virtual int OnSelectionOnFocus(SelectionOnFocus selectionOnFocus)
The selection on focus.
Returns:Returns the selection start to be set when the focus is obtained.
Called when the control is unloaded.
protected virtual void OnUnloadedOverride(object sender, RoutedEventArgs e)
The sender.
eRoutedEventArgsThe RoutedEventArgs instance containing the event data.
Executed when the Value property changes.
protected static void OnValueChangedBase(DependencyObject d, DependencyPropertyChangedEventArgs args, bool processValueChanged)
The owner of the value.
argsDependencyPropertyChangedEventArgsThe changed args.
processValueChangedboolTrue is ProcessValueChanged should be called.
Parses the Mask property and sets the MaskedText.
Process the input when a key has been pressed.
Replaces a char when no mask.
protected virtual void ReplaceChar(StringBuilder text, ref int position)
The text builder.
positionintThe position of the char.
Resets the theme.
public void ResetTheme()
Selects the whole text.
public void SelectAll()
Sets the DefaultStyleKey for the control.
protected virtual void SetDefaultStyleKey()
Sets the offset from the right.
Method that sets predefined separators.
protected virtual void SetSeparators(params Separator[] separatorsArray)
Array of separators to be set.
Checks whether a specified string starts with a separator.
protected virtual bool StartsWithSeparator(StringBuilder text, bool forward, out Separator separator, ref int offset)
The string builder to search in.
forwardboolDirection of the search - true for forward, false for backward.
separatorSeparatorThe found separator.
offsetintThe offset that the search begins from.
Returns:Returns true if the string starts with a separator.
Checks whether a specified string starts with a separator.
protected virtual bool StartsWithSeparator(StringBuilder text, bool forward, out Separator separator)
The string builder to search in.
forwardboolDirection of the search - true for forward, false for backward.
separatorSeparatorThe found separator.
Returns:Returns true if the string starts with a separator.
Forces updates of the EditableTextEnd and EditableTextStart properties.
protected void UpdateEditableTextEndPositions()
Performs a pre-value changing checking whether the inherited control allows the ValueChanging(ed) events to be raised.
protected abstract bool ValueChangingOverride(RoutedEventArgs args)
Returns a boolean flag whether the value change has to be handled or not.
If false is returns, the value change proceeds. If true is returned, the update is terminated.
Events
Occurs when the value is changed.
public event EventHandler<RadRoutedEventArgs> ValueChanged
Occurs before the value is changed.
public event EventHandler<RadMaskedInputValueChangingEventArgs> ValueChanging