.NET MAUI MaskedEntry Value Format
The Telerik MaskedEntry for .NET MAUI allows you to set the behavior of the Value
property in a mask scenario (when the Mask
property is set). By default, the Value
holds the characters without including the prompt characters and the literals defined in the mask.
If the ValueFormat
property is set, the Value
can hold both literals and prompt characters.
The ValueFormat
property is an enum of type Telerik.Maui.MaskedEntry.ValueFormat
and supports the following options:
- (Default mode)
ExcludePromptAndLiterals
IncludePrompt
IncludeLiterals
IncludePromptAndLiterals
ExcludePromptAndLiterals
ExcludePromptAndLiterals
is the default mode. The MaskedEntry value is stored without the prompt characters or literals defined in the mask.
For example, if Mask="##-##"
and you enter 22-2_
, the Value
property will contain 222
.
<telerik:RadTextMaskedEntry x:Name="excludePromptAndLiteralsMask" Mask="##-##" ValueFormat="ExcludePromptAndLiterals" Value="222" AutomationId="excludePromptAndLiteralsMask"/>
IncludePrompt
The Value
property of the MaskedEntry control contains the prompt characters for the missing positions required by the Mask
property.
For example, if Mask="##-##"
and you enter 222
, the Value
property will be 222_
, where the _
character is the default placeholder.
<telerik:RadTextMaskedEntry x:Name="includePromptMask" Mask="##-##" ValueFormat="IncludePrompt" Value="222_" AutomationId="includePromptMask"/>
IncludeLiterals
The Value
MaskedEntry property contains the literals defined in the Mask
property.
For example, if Mask="##-##"
and you enter 22-2_
, the Value
will be 22-2
, where the -
character is the literal from the mask.
<telerik:RadTextMaskedEntry x:Name="includeLiteralsMask" Mask="##-##" ValueFormat="IncludeLiterals" Value="22-2" AutomationId="includeLiteralsMask"/>
IncludePromptAndLiterals
The Value
MaskedEntry property contains both the literals and prompt characters for the missing positions required by the Mask
property.
For example, if Mask="##-##"
and you enter 222,
the Value
property will be 22-2_
.
<telerik:RadTextMaskedEntry x:Name="includePromptAndLiteralsMask" Mask="##-##" ValueFormat="IncludePromptAndLiterals" Value="22-2_" AutomationId="includePromptAndLiteralsMask"/>
For the MaskedEntry Value Format example, go to the SDKBrowser Demo Application and navigate to MaskedEntry -> Features category.