windowsforms-devexpress-dot-xtraeditors-dot-mask-dot-maskproperties-1ae4edb7.md
Gets or sets a mask expression.
Namespace : DevExpress.XtraEditors.Mask
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
public virtual string EditMask { get; set; }
Public Overridable Property EditMask As String
| Type | Default | Description |
|---|---|---|
| String | System.String.Empty |
A string representing a mask expression.
|
Before you construct a mask, specify its type in the MaskProperties.MaskType property. Refer to the Input Mask document for information on the available mask types. This also provides links to documents that describe the mask syntaxes for different mask modes.
The code sample below illustrates how to create a mask for a phone number:
(a value is not entered)
(a value is entered)
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Mask;
..
textEdit1.Properties.Mask.MaskType = MaskType.Simple;
textEdit1.Properties.Mask.EditMask = "(000)000-00-00";
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Mask
textEdit1.Properties.Mask.MaskType = MaskType.Simple
textEdit1.Properties.Mask.EditMask = "(000)000-00-00"
The following code snippets (auto-collected from DevExpress Examples) contain references to the EditMask 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.
textEdit.Properties.Mask.MaskType = MaskType.DateTime;
textEdit.Properties.Mask.EditMask = "d";
break;
winforms-mvvm-best-practices/CS/POCODependencies/SimpleDependenciesUserControl.cs#L20
editor1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
editor1.Properties.Mask.EditMask = "n0";
editor1.Properties.Mask.UseMaskAsDisplayFormat = true;
hyperLinkProperties.Mask.MaskType = MaskType.RegEx;
hyperLinkProperties.Mask.EditMask = UrlEmailMask;
}
dateRepositoryItem.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.DateTime;
dateRepositoryItem.Mask.EditMask = "MMMM dd, yyyy";
EditingFieldExtensionsWin.Instance.RegisterEditor
winforms-mvvm-best-practices/VB/POCODependencies/SimpleDependenciesUserControl.vb#L20
editor1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric
editor1.Properties.Mask.EditMask = "n0"
editor1.Properties.Mask.UseMaskAsDisplayFormat = True
dateRepositoryItem.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.DateTime
dateRepositoryItem.Mask.EditMask = "MMMM dd, yyyy"
EditingFieldExtensionsWin.Instance.RegisterEditor("DateEditor", "Date Editor", "Custom", dateRepositoryItem)
See Also