Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DataFormMaskedEditorAttribute.Mask Property

Gets or sets the editor’s input mask expression.

Namespace: DevExpress.Maui.DataForm

Assembly: DevExpress.Maui.Editors.dll

NuGet Package: DevExpress.Maui.Editors

#Declaration

C#
public string Mask { get; set; }

#Property Value

Type Description
String

A mask expression string.

#Remarks

A mask defines a pattern used for entered values. For example, when a text editor should accept a fixed-length string in a pre-defined format (for example, a phone number, zip code, etc).

DevExpress MAUI DataForm - MaskedEditor

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 - _).
    The following table lists the available metacharacters:

    Character

    Description

    L

    An alphabetic character. For example, A-Z, a-z for the USA.

    0

    A numeric character.

    C

    Any character.

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

The following example shows how to specify a mask and apply it to a value of the PersonalInfo object’s Phone property:

using DevExpress.Maui.DataForm;
// ... 

namespace DataFormExample {
    public class PersonalInfo {
        // ...

        [DataFormMaskedEditor(Mask = "(000) 000-0000")]
        public string Phone { get; set; }
    }
}
See Also