New to Telerik UI for WinUI? Download free 30-day trial

Value Format

RadMaskedTextInput allows you to set the behavior of the Value property in a mask scenario (when the Mask property is set) in the Standard, IP and Email MaskTypes. By default the Value holds the characters without including the prompt characters and the literals defined in the mask. You can alter this and allow the value to hold also literals and prompt characters by setting the ValueFormat property of the control. The property is an enum of type MaskFormat which contains several options described in the next sections.

Example 1: Setting the value mode

<telerik:RadMaskedInput ValueFormat="IncludePromptAndLiterals"/> 

ExcludePromptAndLiterals

This is the default mode and it tells the masked input to store the value without any prompt characters or literals given in the mask. For example, if the Mask is set to "##-##" and you enter "22-22", the Value property will contain "2222". The opposite scenario also applies - if you set the Value property to "2222" the control will display "22-22". If you set the Value to "222" the displayed value will be "22-2_", where the '_' character is the default placeholder.

The displayed text can be obtained via the Text property of RadMaskedTextInput.

IncludeLiterals

When this mode is enabled the Value property of the masked input control will contain also the literals defined in the Mask property. For example if the Mask is set to "##-##" and you enter "22-22" the Value property will contain the value "22-22", where the '-' character is the literal from the mask. If you set the Value to "22-2", the displayed text will be "22-2_", where the '_' character is the default placeholder.

Note that if you set a Value that doesn't include literals, the control will automatically, parse it according to the applied Mask and then update the Value property. For example setting the Value to "222" will display "22-2_" and then the Value will be updated to "22-2".

IncludePrompt

When this mode is enabled the Value property of the masked input control will contain also the prompt characters for the missing positions required by the Mask property. For example if the Mask is set to "####" and you enter "222" the Value property will be "222_", where the '_' character is the default placeholder.

IncludePromptAndLiterals

When this mode is enabled the Value property of the masked input control will contain also the literals and prompt characters for the missing positions required by the Mask property. For example if the Mask is set to "##-##" and you enter "222" the Value property will be "22-2_".

See Also

In this article
Not finding the help you need?