Mask Types
- 3 minutes to read
To enable masked input, select the required mask type using the TextEdit.MaskType (TextEditSettings.MaskType) property and specify a mask string via the TextEdit.Mask (TextEditSettings.Mask) property. A mask string specifies a data input pattern. You can use either predefined mask strings or compose your own mask expressions. Mask strings should be set according to the mask type. Available mask types are listed in the following table.
Mask Type | Use this mask if... | Description | Samples |
---|---|---|---|
None |
| Masked mode is disabled. |
|
Date Date | ... | Masks of the Date Predefined masks can be used to enter values using common date/time patterns. It's also possible to create custom masks that specify which parts (year, month, day, hour, minute, etc.) of a date/time value can be edited. The syntax used for these masks is similar to the date/time formats described in the Date and Time Format Strings topic in MSDN. The data input pattern imposed by the mask is affected by the current culture's settings. These settings can be customized via the Regional Options dialog in the control panel. | Edit Edit |
Numeric | ... | Masks of the Numeric type significantly simplify the input of numeric values (currency, integer, float, etc). Masks in this mode allow numeric values to be entered using various common and custom patterns. It's possible to specify the number of optional and required digits to the left and to the right of the decimal separator, whether or not to display thousand separators, etc. The syntax used for these masks is similar to the numeric formats described in the Numeric Format Strings topic in MSDN. Specific masks are dependent upon the current culture's settings. | Edit Edit |
Simple | ... | This mask type also supports optional characters (for instance, it's possible to specify that the code of a phone number should contain 0 to 3 digits). Any auxiliary characters can be included in these masks, and these auxiliary characters will be displayed in the edit box as is, and will be skipped while editing (for instance, hyphens in phone numbers). | Edit |
Regular | In this mode, masks use the simplified regular expression syntax, which is similar to the one that was implemented in version 2 of Xtra | Edit Mask: \d?\d:\d\d (short time) | |
Reg | ... the length of the string an end-user can enter is not fixed; or ... the value can be entered using one of several alternate forms; or ... only characters within a specific range can be entered at a specific position; or ... the auto-complete feature should be available (an end-user enters text and the editor completes this variant if there are no other alternatives) | In this mode you can construct masks using full functional regular expressions. This gives you great flexibility to control data input. For instance, it's possible to create a single mask that will allow end-users to enter a time value using either the 12-hour or 24-hour format. | Edit |