Back to Devexpress

Masked Input in DevExpress Data Editors for .NET MAUI

maui-404571-editors-masks.md

latest1.8 KB
Original Source

Masked Input in DevExpress Data Editors for .NET MAUI

  • Sep 29, 2023
  • 2 minutes to read

TextEdit supports input masks. A mask defines a pattern for the entered string. You can use it when a text editor should accept a fixed-length string in a pre-defined format (for example, a phone number, zip code, and so on).

Use the Mask property to specify the mask expression. It can include meta and literal characters.

  • A metacharacter is a user input placeholder (identified by the underscore character - _). Use the MaskPlaceholderChar and PlaceholderColor properties to change the character and its color.

  • A literal character is a fixed part of the mask that cannot be edited by users. To display a metacharacter as a literal, precede it with a backslash (/).

The following example configures an input mask for a text editor:

xaml
<dxe:TextEdit Mask="+1 (000) 000-0000" 
              MaskPlaceholderChar="#">
</dxe:TextEdit>

You can also validate editor values once they are being committed to the data source. For more information, refer to the following help topic: Data Validation in DevExpress Data Editors for .NET MAUI.

To specify how numeric and date editors display their values in not focused state, define the NumericEdit.DisplayFormat or DateEdit.DisplayFormat property.