Skip to main content
A newer version of this page is available. .

TextEdit.Mask Property

Gets or sets a mask expression. This is a dependency property.

Namespace: DevExpress.Xpf.Editors

Assembly: DevExpress.Xpf.Core.v20.2.dll

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Core, DevExpress.Wpf.Core

Declaration

public string Mask { get; set; }

Property Value

Type Description
String

A string representing a mask expression.

Remarks

When the editor’s value is set using the Text property, the editor’s value is of System.String type and the Numeric and DateTime mask types may apply incorrectly. Specify the editor’s value using the EditValue property to correctly apply mask settings.

Note

The following TextEdit descendants do not support the masked input:

Specify Mask in Design Time

You can use the Mask Editor to specify editor’s Mask.

Specify Mask in Code

<!-- Long date -->
<dxe:TextEdit Mask="D" MaskType="DateTime"
    MaskUseAsDisplayFormat="True" />
<!-- Currency -->
<dxe:TextEdit Mask="c" MaskType="Numeric"
    MaskUseAsDisplayFormat="True" />
<!-- Email address -->
<dxe:TextEdit Mask="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}"
    MaskType="RegEx" MaskUseAsDisplayFormat="True" />

To learn more, see Masked Input.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Mask property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also