Class MaskedTextBox
public class MaskedTextBox : TextBox, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue
- Inheritance
-
MaskedTextBox
- Implements
- Inherited Members
- Extension Methods
Constructors
MaskedTextBox()
public MaskedTextBox()
MaskedTextBox(MaskedTextProvider)
Constructs the MaskedTextBox with the specified MaskedTextProvider object.
public MaskedTextBox(MaskedTextProvider maskedTextProvider)
Parameters
maskedTextProvider
MaskedTextProvider
Fields
AsciiOnlyProperty
public static readonly StyledProperty<bool> AsciiOnlyProperty
Field Value
CultureProperty
public static readonly StyledProperty<CultureInfo?> CultureProperty
Field Value
HidePromptOnLeaveProperty
public static readonly StyledProperty<bool> HidePromptOnLeaveProperty
Field Value
MaskCompletedProperty
public static readonly DirectProperty<MaskedTextBox, bool?> MaskCompletedProperty
Field Value
MaskFullProperty
public static readonly DirectProperty<MaskedTextBox, bool?> MaskFullProperty
Field Value
MaskProperty
public static readonly StyledProperty<string?> MaskProperty
Field Value
PromptCharProperty
public static readonly StyledProperty<char> PromptCharProperty
Field Value
ResetOnPromptProperty
public static readonly StyledProperty<bool> ResetOnPromptProperty
Field Value
ResetOnSpaceProperty
public static readonly StyledProperty<bool> ResetOnSpaceProperty
Field Value
Properties
AsciiOnly
Gets or sets a value indicating if the masked text box is restricted to accept only ASCII characters. Default value is false.
public bool AsciiOnly { get; set; }
Property Value
Culture
Gets or sets the culture information associated with the masked text box.
public CultureInfo? Culture { get; set; }
Property Value
HidePromptOnLeave
Gets or sets a value indicating if the prompt character is hidden when the masked text box loses focus.
public bool HidePromptOnLeave { get; set; }
Property Value
Mask
Gets or sets the mask to apply to the TextBox.
public string? Mask { get; set; }
Property Value
MaskCompleted
Specifies whether the test string required input positions, as specified by the mask, have all been assigned.
public bool? MaskCompleted { get; }
Property Value
- bool?
MaskFull
Specifies whether all inputs (required and optional) have been provided into the mask successfully.
public bool? MaskFull { get; }
Property Value
- bool?
MaskProvider
Gets the MaskTextProvider for the specified Mask.
public MaskedTextProvider? MaskProvider { get; }
Property Value
PromptChar
Gets or sets the character used to represent the absence of user input in MaskedTextBox.
public char PromptChar { get; set; }
Property Value
ResetOnPrompt
Gets or sets a value indicating if selected characters should be reset when the prompt character is pressed.
public bool ResetOnPrompt { get; set; }
Property Value
ResetOnSpace
Gets or sets a value indicating if selected characters should be reset when the space character is pressed.
public bool ResetOnSpace { get; set; }
Property Value
StyleKeyOverride
Gets the type by which the element is styled.
protected override Type StyleKeyOverride { get; }
Property Value
Remarks
Usually controls are styled by their own type, but there are instances where you want an element to be styled by its base type, e.g. creating SpecialButton that derives from Button and adds extra functionality but is still styled as a regular Button. Override this property to change the style for a control class, returning the type that you wish the elements to be styled as.
Methods
CoerceText(string?)
Coerces the current text.
protected override string? CoerceText(string? text)
Parameters
text
string
Returns
- string
A coerced text.
Remarks
This method also manages the internal undo/redo state whenever the text changes: if overridden, ensure that the base is called or undo/redo won't work correctly.
OnGotFocus(GotFocusEventArgs)
Called before the GotFocus event occurs.
protected override void OnGotFocus(GotFocusEventArgs e)
Parameters
e
GotFocusEventArgsThe event args.
OnKeyDown(KeyEventArgs)
Called before the KeyDown event occurs.
protected override void OnKeyDown(KeyEventArgs e)
Parameters
e
KeyEventArgsThe event args.
OnLostFocus(RoutedEventArgs)
Called before the LostFocus event occurs.
protected override void OnLostFocus(RoutedEventArgs e)
Parameters
e
RoutedEventArgsThe event args.
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
Called when a avalonia property changes on the object.
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
Parameters
change
AvaloniaPropertyChangedEventArgsThe property change details.
OnTextInput(TextInputEventArgs)
Called before the TextInput event occurs.
protected override void OnTextInput(TextInputEventArgs e)
Parameters
e
TextInputEventArgsThe event args.