Skip to main content

DxMaskedInput<T>.MaskMode Property

Specifies a mask mode.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(MaskMode.Auto)]
[Parameter]
public MaskMode MaskMode { get; set; }

Property Value

Type Default Description
MaskMode Auto

A MaskMode enumeration value.

Available values:

Name Description
Auto

The component activates a mask type based on the Value data type.

Numeric

The component activates the Numeric mask type.

DateTime

The component activates the Date-time mask type.

RegEx

The component activates the Regular Expression mask type.

Text

The component activates the Text mask type.

DateTimeOffset

The component activates the Date-time Offset mask type.

TimeSpan

The component activates the Time Span mask type.

DateOnly

The component activates the DateOnly mask type.

TimeOnly

The component activates the TimeOnly mask type.

Remarks

The Masked Input component activates a mask type based on the data type of the component’s Value property. For instance, if you bind the component value to a DateTime object, the component activates the date-time mask type.

The component cannot automatically activate the regular expression mask type because no data type corresponds to this mask type. Set the MaskMode property to RegEx to manually activate the regular expression mask type:

<DxMaskedInput @bind-Value="Value" 
               Mask="[A-Z]*" 
               MaskMode="@MaskMode.RegEx" />
@code {
    String Value { get; set; }
}

The Masked Input can convert strings that store data source objects to compatible data types. For instance, the component can convert the “11/09/2022” string to DateTime and DateTimeOffset objects. Use the MaskMode property to manually activate a mask type and convert the string to the corresponding data type.

The following code snippet activates a date-time mask type when you bind the component’s value to a String object:

<DxMaskedInput @bind-Value="Value"
               Mask="@DateTimeMask.ShortDate"
               MaskMode="@MaskMode.DateTime" />
@code {
    String Value { get; set; } = "11/09/2022";
}

Refer to the following section for more information: Apply a Mask.

See Also