[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Collapse]Data Editors
    Included Components
   [Expand]Implementation Details
   [Expand]Getting Started
   [Expand]Editor Types
   [Collapse]Common Features
    [Expand]Obtaining Editor Values
    [Expand]Binding to Data
     In-Place Mode
    [Expand]Editor Operation Modes
    [Collapse]Masked Input
      Mask Types
      Mask Type: Date-time
      Mask Type: Extended Regular Expressions
      Mask Type: Numeric
      Mask Type: Simple
      Mask Type: Simplified Regular Expressions
    [Expand]Input Validation
     Incremental Search
   [Expand]Range Control
   [Expand]Visual Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Mask Type: Simple

This document describes the syntax for creating masks of the Simple mask type. These masks are quite plain and therefore they do not allow you to implement sophisticated data input patterns. They can however be useful when an editor should accept a string that has a fixed format and is of a fixed length (for instance, a phone number, zip code, etc).

For general information on the other masked modes refer to the Mask Types document.

In this topic:

Expanded Simple Mask Mode

To enable the Simple mask type, set the editor's TextEdit.MaskType (or the TextEditSettings.MaskType for the in-place editors) property to MaskType.Simple. The mask itself should be specified using the TextEdit.Mask (or TextEditSettings.Mask) property.

A mask represents a string which can consist of metacharacters, special and literal characters.

Expanded Metacharacters

Metacharacters are used to represent a range of symbols. An end-user can enter text only in the positions which correspond to metacharacters. When a metacharacter is found at a specific position in the mask an end-user can enter any character from the related range in this position in the edit box. The following table lists the available metacharacters:

Character Meaning
L An L character requires an alphabetic character in this position. For the U.S. this is A-Z, a-z.
l An l character permits only an alphabetic character in this position, but doesn't require it.
A An A character requires an alphanumeric character in this position. For the U.S. this is A-Z, a-z, 0-9.
a An a character permits only an alphanumeric character in this position, but doesn't require it.
C A C character requires an arbitrary character in this position.
c A c character permits an arbitrary character in this position, but doesn't require it.
0 A 0 character requires a numeric character in this position.
9 A 9 character permits only a numeric character in this position, but doesn't require it.
# A # character permits only a numeric character or a plus or minus sign in this position, but doesn't require it.

Expanded Special Characters

The following table lists the available special characters which are used to control the case of the input string and to represent various delimiters and currency symbols.

Character Meaning
> If a > character appears in the mask, all the characters that follow it are converted to uppercase until the end of the mask or until a < character is encountered.
< If a < character appears in the mask, all the characters that follow it are converted to lowercase until the end of the mask or until a > character is encountered.
<> If these two characters appear together in a mask, no case checking is performed and the data is formatted with the case used by the end-user during data entry.
/ A / character is used to separate the months, days, and years in dates. If the character that separates the months, days, and years is different in the regional settings of the system that the application runs on that character will be used instead.
: A : character is used to separate the hours, minutes, and seconds in time values. If the character that separates the hours, minutes, and seconds is different in the regional settings of the system that the application runs on that character will be used instead.
$ A $ character is used to designate currency values. If the character that designates the currency values is different in the regional settings of the system that the application runs on that character is used instead.

Expanded Literal Characters

A character that is neither a metacharacter nor a special character is called a literal. Literals are inserted automatically as is into the edit box in their positions defined by the mask. An end-user has no need to enter literal characters. The cursor skips over them during editing.

The metacharacters and special characters can also appear as literal characters if they are preceded by a backslash (\).

Expanded Examples

1. A mask for entering a telephone number: (000)000-00-00.

Each '0' metacharacter in this mask requires a numeric character in the corresponding position. No characters can be omitted. The '-', '(' and ')'characters in the mask are literals.

The following are images of an editor that uses this mask:

(a value is not entered)

(a value is entered)

2. A mask for entering a telephone number with an optional area code: (999)000-00-00

Here the '9' metacharacter allows end-users to omit the area code part of a phone number.

(a valid phone number without a code part)

3. A mask for entering an alpha-numeric sequence:\A>LL-00

Here '\A' stands for the literal character 'A'. Since 'A' is used as a metacharacter the backslash must be used to make 'A' appear as a literal. The '>' command specifies that the following text should be in uppercase. The 'LL' substring indicates that two alphabetical characters should be inserted in this position. The '00' substring is a placeholder for two digits.

(a value is not entered)

(a value is entered)

Is this topic helpful?​​​​​​​