Back to Devexpress

DxMaskedInput<T>.MaskMode Property

blazor-devexpress-dot-blazor-dot-dxmaskedinput-1-e6beef91.md

latest3.7 KB
Original Source

DxMaskedInput<T>.MaskMode Property

Specifies a mask mode.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

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

Property Value

TypeDefaultDescription
MaskModeAuto

A MaskMode enumeration value.

|

Available values:

NameDescription
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:

razor
<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:

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

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

See Also

DxMaskedInput<T> Class

DxMaskedInput<T> Members

DevExpress.Blazor Namespace