[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Collapse]Editors and Simple Controls
   [Collapse]Simple Editors
    [Expand]Included Components
    [Expand]Editors Structure
    [Collapse]Editors Features
      Text Editing Overview
     [Collapse]Input Mask
       Mask Type: Numeric
       Mask Type: Date-time
       Mask Type: Extended Regular Expressions
       Mask Type: Simple
       Mask Type: Simplified Regular Expressions
     [Expand]Format and Parse Editor Values
     [Expand]Editor Buttons
     [Expand]Dropdown Editors Overview
      Image Editing Menu
     [Expand]Data Binding Overview
     [Expand]Appearance Customization
     [Expand]Miscellaneous Features
    [Expand]Member Tables
    [Expand]Examples
   [Expand]Lookup Editors
   [Expand]Token Edit Control
   [Expand]Breadcrumb Edit Control
   [Expand]Range Control
   [Expand]Image Slider
    Camera Control
    Templated ListBox Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[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]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Mask Type: Simple

The Simple mask type allows users to enter alphabetic, numeric or alphanumeric characters at specific positions. For example, phone numbers, zip codes, and social security numbers.

Note

Run the XtraEditors demo to try out input masks.

Expanded Mask Type and Mask Expression

The RepositoryItemTextEdit.Mask property provides access to a MaskProperties class instance that specifies an input mask. Set the MaskProperties.MaskType property to MaskType.Simple to enable the simplified mask format. Use the MaskProperties.EditMask property to specify the mask expression.

Expanded Metacharacters

A metacharacter specifies a range of characters that users can enter. The following table lists the available metacharacters.

Character Description
L A mandatory alphabetic character. For example, A-Z, a-z for the USA.
l An optional alphabetic character.
A A mandatory alphanumeric character. For example, A-Z, a-z, 0-9 for the USA.
a An optional alphanumeric character.
C A mandatory arbitrary character.
c An optional arbitrary character.
0 A mandatory numeric character.
9 An optional numeric character.
# An optional numeric character, the plus or minus sign.

Expanded Special Characters

Special characters convert to uppercase/lowercase, add date/time separators, etc. The following table lists the available special characters.

Character Description
> Converts subsequent characters to uppercase.
< Converts subsequent characters to lowercase.
<> Discards case conversion for subsequent characters.
/ Separates months, days, and years. The culture's System.Globalization.DateTimeFormatInfo.DateSeparator property specifies the actual character.
: Separates hours, minutes, and seconds. The culture's System.Globalization.DateTimeFormatInfo.TimeSeparator property specifies the actual character.
$ Inserts the currency symbol. The culture's System.Globalization.NumberFormatInfo.CurrencySymbol property specifies the actual character.

Expanded Literal Characters

Literal characters are arbitrary read-only characters in the edit box. If you add a character that is not a meta or special character into a mask expression, the character is displayed in the edit box as is. To display a meta or special character as a literal, precede it with a backslash.

Expanded Examples

Example 1

(000)000-00-00 - a mask that allows users to enter a phone number. Each '0' metacharacter requires to enter a digit. Dashes and brackets are literals.

  • Value is not entered:

  • Value is entered:

Example 2

(999)000-00-00 - a phone number with an optional area code. Each '9' metacharacter allows users to omit a digit.

  • Value is a valid phone number without a code part:

Example 3

\A>LL-00 - a mask to enter two upper-case letters and two numbers separated by a dash and preceded with the 'A' literal. A backslash precedes the literal to distinguish it from a metacharacter.

  • Value is not entered:

  • Value is entered:

Expanded See Also

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