Mask Types

  • 3 minutes to read

A mask can consist of several parts. The following part types are available:

Prompts

A prompt specifier represents a single symbol. During editing, prompt specifiers are represented within the edit box using a placeholder character defined via the MaskSettings.PromptChar property.

A, a - Alphanumeric

L, l - Alphabetic

C, c - Any char

NOTE

Specifiers in upper case require that a prompt should be filled. If such a prompt is left empty - the mask will not be valid.

> - Converts all symbols to the right to upper case

< - Converts all symbols to the right to lower case

~ - Cancels effect of the "<" or ">" symbol

# - Optional digit or signum symbol

9 - Optional digit

0 - Required digit

Culture dependent separators

Standard culture dependent separators are allowed, such as $ : / , . and etc.

Ranges

The range mask type lets you define a range of allowable integer values by specifying the minimum and maximum limits. You can define a range's default value, allow zero-filling, and control whether a culture dependent thousand separator is automatically displayed. This mask type supports displaying mask hints.

NOTE

It is not allowed to use the # symbol in the range mask type.

<0..100>

<0..50..100> - With default value

<-100..100> - Negative values are allowed

<00..100>, <01..31> - Zero-filling is enabled

<0..9999g> - Thousand separator is added automatically (the separator is specified by the current culture)

Enumerations

Using this mask type, you can define a collection of allowable string values and specify the default value, if required. This mask type supports displaying mask hints.

<A|B|C>

<A|*B|C> - With default value

Use the MaskSettings.AllowEscapingInEnums property to control whether a backslash symbol () and quotes (single ' ' and double " ") can be used as escape characters in enumeration masks to solve the problem of using special characters inside a mask string.

Date-time specifiers

Standard and custom date-time specifiers are allowed, such as 'd', 'dd MM yyyy' and so on.

Literals

Literal symbols are typically used within mask expressions to group or separate different mask parts (such as parentheses in phone numbers or dashes in serial numbers, for instance) or for informative purposes. The following are considered as literals:

  • Symbols not specified above

  • A symbol preceded by a backslash ''

  • A group of symbols wrapped with quotation marks ("$ : / , .") or apostrophes ('$ : / , .')

Use the MaskSettings.IncludeLiterals property to control which kinds of literal symbols composing a mask should be included into an editor's value.

See Also