.NET MAUI Numeric Mask
To validate the user input as numeric values, use the NumericMaskedEntry
.
The numeric mask displays the following values:
- Percent values.
- Decimal values.
- Currency (culture-aware).
- Fixed point values.
Through the Mask
property you can specify the exact format of the expected input. The following table lists the supported formats and the resulting type of the value with each format:
Mask | Numeric Type | Resulting .NET Type |
---|---|---|
"C" or "c"
|
Currency | decimal |
"D" or "d"
|
Standard | long (int64) |
"F" or "f"
|
Fixed-point | decimal |
"G" or "g"
|
Fixed-point | decimal |
"N" or "n"
|
Decimal | decimal |
"P" or "p"
|
Percent | double |
Other |
Decimal | decimal |
For the full list of supported masks (except for the "E"
and "X"
ones), refer to the Standard Numeric masks MSDN article.
The following example demonstrates how to set the RadNumericMaskedEntry
with the Currency
value:
<telerik:RadNumericMaskedEntry Mask="C" AutomationId="numericMaskC"/>
The image below shows the end result.
For the MaskedEntry Numeric Mask examples, go to the SDKBrowser Demo Application and navigate to MaskedEntry -> Mask Types category.