Back to Devexpress

MaskProperties.MaskType Property

windowsforms-devexpress-dot-xtraeditors-dot-mask-dot-maskproperties.md

latest6.7 KB
Original Source

MaskProperties.MaskType Property

Gets or sets the mask type.

Namespace : DevExpress.XtraEditors.Mask

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public virtual MaskType MaskType { get; set; }
vb
Public Overridable Property MaskType As MaskType

Property Value

TypeDefaultDescription
MaskTypeNone

A MaskType value specifying the mask type used.

|

Available values:

NameDescription
None

Specifies that the mask feature is disabled.

| | DateTime |

Specifies that the editor should accept date/time values and that the mask string must use the DateTime format syntax.

| | DateTimeAdvancingCaret |

The DateTime mask mode with the caret automatic movement feature.

After an end-user enters and completes a specific portion of a date/time value the caret automatically moves to the following part of the date/time value that can be edited.

| | Numeric |

Specifies that the editor should accept numeric values and that the mask string must use the Numeric format syntax.

| | RegEx |

Specifies that the mask should be created using full-functional regular expressions.

| | Regular |

Specifies that the mask should be created using simplified regular expression syntax.

| | Simple |

Specifies that the mask should use the simplified syntax.

| | Custom |

Specifies that the editor uses a custom mask manager.

To implement a custom mask manager which will deal with masks in a custom manner create a custom editor and override its CreateMaskManager method. This method should then supply a custom mask manager when the MaskProperties.MaskType property is set to Custom.

| | TimeSpan |

Specifies that the editor should accept time span values.

| | TimeSpanAdvancingCaret |

Specifies that the editor should accept time span values. Supports the caret automatic movement feature.

|

Remarks

Refer to the Input Mask document for information on choosing the mask type that meets your requirements.

The mask expression should be constructed using the syntax that is determined by the mask type. Use the MaskProperties.EditMask property to specify the mask expression.

The following code snippets (auto-collected from DevExpress Examples) contain references to the MaskType 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.

xaf-how-to-dynamically-change-mask-settings-based-on-the-current-object/CS/EFCore/DynamicMaskEF/DynamicMaskEF.Win/Controllers/WinChangeMaskController.cs#L15

csharp
case EditMask.Date:
    textEdit.Properties.Mask.MaskType = MaskType.DateTime;
    textEdit.Properties.Mask.EditMask = "d";

winforms-mvvm-best-practices/CS/POCODependencies/SimpleDependenciesUserControl.cs#L19

csharp
editor1.Dock = DockStyle.Top;
editor1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
editor1.Properties.Mask.EditMask = "n0";

xaf-how-to-show-a-hyper-link-url-email-etc-for-a-business-class-property/CS/EFCore/HyperLinkEditorEF/HyperLinkEditorEF.Win/Editors/WinHyperLinkStringPropertyEditor.cs#L35

csharp
EditMaskType = EditMaskType.RegEx;
hyperLinkProperties.Mask.MaskType = MaskType.RegEx;
hyperLinkProperties.Mask.EditMask = UrlEmailMask;

reporting-winforms-custom-controls-for-editing-report-content-in-print-preview/CS/RegisterCustomFieldEditor/Form1.cs#L37

csharp
dateRepositoryItem.Mask.UseMaskAsDisplayFormat = true;
dateRepositoryItem.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.DateTime;
dateRepositoryItem.Mask.EditMask = "MMMM dd, yyyy";

winforms-mvvm-best-practices/VB/POCODependencies/SimpleDependenciesUserControl.vb#L19

vb
editor1.Dock = DockStyle.Top
editor1.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric
editor1.Properties.Mask.EditMask = "n0"

reporting-winforms-custom-controls-for-editing-report-content-in-print-preview/VB/RegisterCustomFieldEditor/Form1.vb#L32

vb
dateRepositoryItem.Mask.UseMaskAsDisplayFormat = True
dateRepositoryItem.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.DateTime
dateRepositoryItem.Mask.EditMask = "MMMM dd, yyyy"

See Also

MaskProperties.EditMask

MaskProperties Class

MaskProperties Members

DevExpress.XtraEditors.Mask Namespace