# Mask Elements

## Content

**MaskedTextBox for WPF and Silverlight** supports the standard number formatting strings defined by Microsoft. The **Mask** string should consist of one or more of the masking elements as detailed in the following table:

| Element | Description |
| ------- | ----------- |
| 0 | Digit, required. This element will accept any single digit between 0 and 9. |
| 9 | Digit or space, optional. |
| # | Digit or space, optional. If this position is blank in the mask, it will be rendered as a space in the **Text** property. Plus (+) and minus (-) signs are allowed. |
| L | Letter, required. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z] in regular expressions. |
| ? | Letter, optional. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z]? in regular expressions. |
| & | Character, required. |
| C | Character, optional. Any non-control character. |
| A | Alphanumeric, optional. |
| a | Alphanumeric, optional. |
| . | Decimal placeholder. The actual display character used will be the decimal symbol appropriate to the format provider. |
| , | Thousands placeholder. The actual display character used will be the thousands placeholder appropriate to the format provider. |
| : | Time separator. The actual display character used will be the time symbol appropriate to the format provider. |
| / | Date separator. The actual display character used will be the date symbol appropriate to the format provider. |
| $ | Currency symbol. The actual character displayed will be the currency symbol appropriate to the format provider. |
| < | Shift down. Converts all characters that follow to lowercase. |
| > | Shift up. Converts all characters that follow to uppercase. |
|  
| \\ | Escape. Escapes a mask character, turning it into a literal. "\\\" is the escape sequence for a backslash. |
| All other characters | Literals. All non-mask elements will appear as themselves within **C1MaskedTextBox**. Literals always occupy a static position in the mask at run time, and cannot be moved or deleted by the user. |

The decimal (.), thousandths (,), time (:), date (/), and currency ($) symbols default to displaying those symbols as defined by the application's culture.

**Literals**

In addition to the mask elements already defined, other characters can be included in the mask. These characters are literals. Literals are non-mask elements that will appear as themselves within [C1MaskedTextBox](/componentone/api/wpf/online-basiclibrary/dotnet-framework-api/C1.WPF.4.6.2/C1.WPF.C1MaskedTextBox.html). Literals always occupy a static position in the mask at run time, and cannot be moved or deleted by the user.

For example, if the **Mask** property has been set to "(999)-000-0000" to define a phone number, the mask characters include the "9" and "0" elements. The remaining characters, the dashes and parentheses, are literals. These characters will appear as they are in the **C1MaskedTextBox** control.

>type=note
> **Note**: The [TextMaskFormat](/componentone/api/wpf/online-basiclibrary/dotnet-framework-api/C1.WPF.4.6.2/C1.WPF.C1MaskedTextBox.TextMaskFormat.html) property must be set to **IncludeLiterals** or **IncludePromptAndLiterals** for literals to be used. If you do not want literals to be used, set **TextMaskFormat** to **IncludePrompt** or **ExcludePromptAndLiterals**.

## See Also

[Adding Mask](/componentone/docs/wpf/online-basiclibrary/overview/MaskedTextBox/MaskElements/AddingMask)