Table of Contents

Class PatternMask

Namespace
MudBlazor
Assembly
MudBlazor.dll
public class PatternMask : BaseMask, IMask
Inheritance
PatternMask
Implements
Derived
Inherited Members
Extension Methods

Constructors

PatternMask(string)

public PatternMask(string mask)

Parameters

mask string

Properties

CleanDelimiters

If true, all characters which are not defined in the mask (delimiters) are stripped from text.

public bool CleanDelimiters { get; set; }

Property Value

bool

Placeholder

If set, the mask will print placeholders for all non-delimiters that haven't yet been typed. For instance a mask "000-000" with input "1" will show "1__-___" as Text.

public char? Placeholder { get; set; }

Property Value

char?

Transformation

A function for changing input characters after they were typed, i.e. lower-case to upper-case, etc.

public Func<char, char> Transformation { get; set; }

Property Value

Func<char, char>

Methods

AlignAgainstMask(string, int)

Applies the mask to the given text starting at the given offset and returns the masked text.

protected virtual string AlignAgainstMask(string text, int maskOffset = 0)

Parameters

text string
maskOffset int

Returns

string

Backspace()

Implements the effect of the Backspace key at the current cursor position

public override void Backspace()

Delete()

Implements the effect of the Del key at the current cursor position

public override void Delete()

DeleteSelection(bool)

protected override void DeleteSelection(bool align)

Parameters

align bool

FillWithPlaceholder(string)

Fill the rest of the text with Placeholder but only if it is set

protected virtual string FillWithPlaceholder(string text)

Parameters

text string

Returns

string

GetCleanText()

Return the Text without Placeholders. If CleanDelimiters is enabled, then also strip all undefined characters. For instance, for a mask "0000 0000 0000 0000" the space would be an undefined character (a delimiter) unless it were defined as a mask character in MaskChars.

public override string GetCleanText()

Returns

string

InitInternals()

protected override void InitInternals()

Insert(string)

Inserts given text at caret position

public override void Insert(string input)

Parameters

input string

One or multiple characters of input

IsMatch(char, char)

protected virtual bool IsMatch(char maskChar, char textChar)

Parameters

maskChar char
textChar char

Returns

bool

ModifyFinalText(string)

protected virtual string ModifyFinalText(string text)

Parameters

text string

Returns

string

ModifyPartiallyAlignedMask(string, string, int, ref int, ref int, ref string)

protected virtual void ModifyPartiallyAlignedMask(string mask, string text, int maskOffset, ref int textIndex, ref int maskIndex, ref string alignedText)

Parameters

mask string
text string
maskOffset int
textIndex int
maskIndex int
alignedText string

UpdateFrom(IMask)

public override void UpdateFrom(IMask other)

Parameters

other IMask

UpdateText(string)

protected override void UpdateText(string text)

Parameters

text string