Skip to main content

DxMaskedInputSettings.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

An 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 editor activates a mask type based on the column data type. For instance, if you bind the column to a DateTime object, the editor 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.

@inject EmployeeService EmployeeData

<DxGrid Data="@employees" PageSize="4" EditMode="GridEditMode.EditRow">
    <Columns>
        <DxGridCommandColumn />
        <DxGridDataColumn FieldName="FirstName" />
        <DxGridDataColumn FieldName="LastName" />
        <DxGridDataColumn FieldName="BirthDate" />
        <DxGridDataColumn FieldName="HireDate" />
        <DxGridDataColumn FieldName="Email"  >
            <EditSettings>
                <DxMaskedInputSettings MaskMode="MaskMode.RegEx" Mask="@EmailMask" />
            </EditSettings>
        </DxGridDataColumn>
    </Columns>
</DxGrid>

@code {
    Employee[]? employees;
    string EmailMask { get; set; } = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}";

    protected override async Task OnInitializedAsync() {
        employees = await EmployeeData.GetData();
    }
}

Edit form with masked input

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.

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

To change the mask mode at runtime, use the IMaskedInputSettings.MaskMode property instead.

Implements

See Also