wpf-devexpress-dot-xpf-dot-editors-dot-textedit-778191e7.md
Gets or sets a mask expression. This is a dependency property.
Namespace : DevExpress.Xpf.Editors
Assembly : DevExpress.Xpf.Core.v25.2.dll
NuGet Package : DevExpress.Wpf.Core
public string Mask { get; set; }
Public Property Mask As String
| Type | Description |
|---|---|
| String |
A string representing a mask expression.
|
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:
You can use the Mask Editor to specify editor’s Mask.
<!-- 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.
EditValue="{Binding Path=Address.ZipCode, Mode=TwoWay}"
Mask="00000"
MaskType="Simple" />
wpf-scheduler-highlight-time-intervals/CS/SchedulerCellTemplate/MainWindow.xaml#L19
<dxe:TextEdit EditValue="{Binding LunchStart, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
Mask="HH:mm:ss" MaskType="DateTime" MaskUseAsDisplayFormat="True" Margin="4,0,4,0" />
</dxlc:LayoutItem>
wpf-reporting-use-custom-controls-for-editing-report-content-in-print-preview/CS/App.xaml#L17
MaxValue="{Binding Path=(dxp:DocumentPreviewControl.ActualViewer).DataContext.DateTimeMax, RelativeSource={RelativeSource Self}}"
MaskUseAsDisplayFormat="True" Mask="MMMM dd, yyyy" ShowWeekNumbers="True" ShowToday="True" Name="PART_Editor" />
</DataTemplate>
<DataTemplate x:Key="intCellTemplate">
<dxe:TextEdit Name="PART_Editor" MaskType="Numeric" Mask="d"/>
</DataTemplate>
local:PivotGridEditHelper.LostFocusCommand="{x:Static local:PivotGridEditHelper.Enter}"
Mask="[0-9]*\.[0-9]{0,2}"
MaskType="RegEx">
See Also