New to Telerik UI for .NET MAUI? Start a free 30-day trial

Setting the Mask in .NET MAUI MaskedEntry

The Telerik MaskedEntry for .NET MAUI exposes a Mask(string) property, which represents a string of characters restricting user input. The Mask property can contain literals and special mask characters depending on the used mask type (numeric, text, or regex).

Mask for the NumericMaskedEntry

You can set one of the Standard Numeric Format Specifiers to the Mask property of the RadNumericMaskedEntry.

This example shows how to set the Percent (double) Mask

<telerik:RadNumericMaskedEntry Mask="P" AutomationId="numericMaskP"/>

This example shows how to set the Fixed (decimal) Mask

<telerik:RadNumericMaskedEntry Mask="F" AutomationId="numericMaskF"/>

This example shows how to set the Fixed (decimal) Mask

<telerik:RadNumericMaskedEntry Mask="G" AutomationId="numericMaskG"/>

This example shows how to set the Decimal (decimal) Mask

<telerik:RadNumericMaskedEntry Mask="N" AutomationId="numericMaskN"/>

This example shows how to set the Standard (long) Mask

<telerik:RadNumericMaskedEntry Mask="D" AutomationId="numericMaskD"/>

This example shows how to set the Currency (decimal) Mask

<telerik:RadNumericMaskedEntry Mask="C" AutomationId="numericMaskC"/>

Mask for the TextMaskedEntry

To allow users to enter only numbers inside the RadTextMaskedEntry, apply the Mask for numeric restriction:

<telerik:RadTextMaskedEntry Mask="(000) 000-000" PromptChar=" " AutomationId="textMaskNumbersOnly"/>

To allow users to enter only literals inside the RadTextMaskedEntry, apply the Mask for letter characters restriction:

<telerik:RadTextMaskedEntry Mask="LLLLL" AutomationId="textMaskTextOnly"/>

Mask for RegexMaskedEntry

You can define an input pattern of your choice and set it to the Mask property of the RadRegexMaskedEntry:

<telerik:RadRegexMaskedEntry Mask="^(\+0?1\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$" Placeholder="(415) 555-2671" AutomationId="regexMaskPhoneNumber"/>

For the MaskedEntry Mask Types examples, go to the SDKBrowser Demo Application and navigate to MaskedEntry -> Mask Types category.

See Also

In this article