Class MultiMask
- Namespace
- MudBlazor
- Assembly
- MudBlazor.dll
A mask which can change its pattern based on partial input.
public class MultiMask : PatternMask, IMask
- Inheritance
-
MultiMask
- Implements
- Inherited Members
- Extension Methods
Remarks
A multi-mask consists of multiple MaskOption values which define when a particular mask is used.
For example: a credit card number can be from any card provider, yet each provider has their own numbering rules. A multi-mask would allow each provider's rules to be used together in a single mask.
Constructors
MultiMask(string, params MaskOption[])
Creates a new multi mask from the specified mask options.
public MultiMask(string defaultMask, params MaskOption[] options)
Parameters
defaultMask
stringThe starting mask to use for input values.
options
MaskOption[]The list of masks to use depending on the input so far.
Remarks
A multi-mask consists of multiple MaskOption values which define when a particular mask is used.
For example: a credit card number can be from any card provider, yet each provider has their own numbering rules. A multi-mask would allow each provider's rules to be used together in a single mask.
Properties
DetectedOption
The currently used mask.
public MaskOption? DetectedOption { get; }
Property Value
Remarks
Defaults to null
. Changes automatically as the input changes.
OptionDetected
Occurs when DetectedOption has changed.
public Action<MaskOption?, string> OptionDetected { get; set; }
Property Value
Methods
Backspace()
Triggers a backspace at the current cursor position.
public override void Backspace()
Remarks
Has the same effect as pressing the Backspace
key.
CheckOption()
Chooses the best MaskOption based on the input so far.
protected virtual MaskOption? CheckOption()
Returns
Delete()
Triggers a delete at the current cursor position.
public override void Delete()
Remarks
Has the same effect as pressing the Delete
key.
DoCheckAndRedo(Action)
Selects the current MaskOption and applies an input character.
protected void DoCheckAndRedo(Action action)
Parameters
action
ActionThe action to apply to the input.
Insert(string)
Inserts text at the current cursor position.
public override void Insert(string input)
Parameters
input
stringThe characters to insert.
UpdateFrom(IMask)
Copies the mask and mask characters from the specified mask.
public override void UpdateFrom(IMask other)
Parameters
other
IMaskThe mask to copy from.