DxMaskedInput<T>.Mask Property
Specifies a mask pattern.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v22.1.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public string Mask { get; set; }
Property Value
Type | Description |
---|---|
String | A mask pattern string. |
Remarks
Use the Mask property to set up a Masked Input‘s mask pattern in code.
Mask Types
The Masked Input component supports four mask types:
Apply a Mask
To set up a mask, assign a desired mask pattern to the Mask property.
<DxMaskedInput @bind-Value="Value"
Mask="(000) 000-0000" >
</DxMaskedInput>
@code{
String Value { get; set; }
}
You should also set the MaskMode property to MaskMode.RegEx
to enable a Regular Expression mask.
<DxMaskedInput @bind-Value="Value"
Mask="[A-Z]*"
MaskMode="@MaskMode.RegEx" />
@code{
String Value { get; set; }
}
Configure Mask Properties
If required, configure mask settings (the current culture, placeholder characters, and so on). For this purpose, add the component that corresponds to the mask type (DxDateTimeMaskProperties, DxNumericMaskProperties, DxTextMaskProperties, and DxRegExMaskProperties) to the Masked Input markup and specify the component’s properties.
The code below enables the French culture and changes the default mask placeholder (_
) to the custom character (#
).
@using System.Globalization
<DxMaskedInput @bind-Value="Value"
Mask="[A-Z]{3}-[0-9]{2}"
MaskMode="@MaskMode.RegEx">
<DxRegExMaskProperties Culture="Culture" Placeholder="Placeholder" />
</DxMaskedInput>
@code{
String Value { get; set; }
char Placeholder = '#';
CultureInfo Culture = CultureInfo.GetCultureInfo("fr-FR");
}
For more information on available mask patterns and related settings, refer to the following topic: Masks.