Back to Devexpress

TextEdit.MaskType Property

wpf-devexpress-dot-xpf-dot-editors-dot-textedit-ee6a61cb.md

latest7.1 KB
Original Source

TextEdit.MaskType Property

Gets or sets the mask type. This is a dependency property.

Namespace : DevExpress.Xpf.Editors

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

NuGet Package : DevExpress.Wpf.Core

Declaration

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

Property Value

TypeDescription
MaskType

One of the MaskType enumeration values.

|

Available values:

Show 16 items

NameDescription
None

The masked input is disabled.

| | DateTime |

The editor accepts date/time values. The mask string must use the DateTime format syntax.

| | DateTimeAdvancingCaret |

The DateTime mask with automatic navigation between mask parts.

If a user completes a part of the value, the caret moves to the next editable part.

| | DateOnly |

The editor accepts date values. The mask string must use the DateOnly format syntax (.NET 6.0+ required).

| | DateOnlyAdvancingCaret |

The DateOnly mask with automatic navigation between mask parts.

If a user completes a part of the value, the caret moves to the next editable part.

| | DateTimeOffset |

The editor accepts date/time values with the timezone offset. The mask string must use the DateTimeOffset format syntax.

| | DateTimeOffsetAdvancingCaret |

The DateTimeOffset mask with automatic navigation between mask parts.

If a user completes a part of the value, the caret moves to the next editable part.

| | TimeOnly |

The editor accepts time values. The mask string must use the TimeOnly format syntax (.NET 6.0+ required).

| | TimeOnlyAdvancingCaret |

The TimeOnly mask with automatic navigation between mask parts.

If a user completes a part of the value, the caret moves to the next editable part.

| | Numeric |

The editor accepts numeric values. The mask string must use the Numeric format syntax.

| | RegEx |

The mask should use the full-functional regular expressions.

| | Regular |

The mask should use the simplified regular expression syntax.

| | Simple |

The mask should use the simplified syntax.

| | TimeSpan |

The editor accepts time interval values. The mask string must use the TimeSpan format syntax.

| | TimeSpanAdvancingCaret |

The TimeSpan mask with automatic navigation between mask parts.

If a user completes a part of the value, the caret moves to the next editable part.

| | Custom |

Applies the mask specified in the CustomMask event.

|

Remarks

Note

The following TextEdit descendants do not support the masked input:

Specify Mask Type in Design Time

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

Specify Mask Type in Code

xaml
<!-- 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 Mask Types.

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.

wpf-synchronous-theme-preload-with-splashscreen/CS/ThemePreloadwithSplashscreen/ComplexWindow.xaml#L102

xml
Mask="00000"
        MaskType="Simple" />
</dxlc:LayoutItem>

wpf-scheduler-highlight-time-intervals/CS/SchedulerCellTemplate/MainWindow.xaml#L19

xml
<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#L20

xml
<DataTemplate x:Key="{dxpt:EditingFieldThemeKeyExtension ResourceKey=PhoneNumberEditor}">
    <dxe:TextEdit x:Name="PART_Editor" MaskType="Simple" Mask="(999)000-00-00" MaskUseAsDisplayFormat="True" EditValue="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>

wpf-data-grid-create-custom-gridcontrol-that-displays-horizontal-columns/CS/dxExample/MainWindow.xaml#L16

xml
<DataTemplate x:Key="intCellTemplate">
    <dxe:TextEdit Name="PART_Editor" MaskType="Numeric" Mask="d"/>
</DataTemplate>

wpf-pivot-grid-define-custom-cell-template-to-performing-data-editing/CS/HowToEditCell/MainWindow.xaml#L38

xml
Mask="[0-9]*\.[0-9]{0,2}"
MaskType="RegEx">
<dxe:TextEdit.InputBindings>

See Also

TextEdit Class

TextEdit Members

DevExpress.Xpf.Editors Namespace