Introducing the New .NET MAUI Masked Entry Control
Tags: netmaui, mobile, ui, whatsnew
Published: 2023-04-06 07:17:18

---
title: Introducing the New .NET MAUI Masked Entry Control
published: true
date: 2023-04-05 11:44:03 UTC
tags: netmaui, mobile, ui, whatsnew
canonical_url: https://www.syncfusion.com/blogs/post/dotnet-maui-masked-entry-control.aspx
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4hix6u6sqt1gzargj0rl.png
---
In Syncfusion’s Essential Studio [2023 Volume 1](https://www.syncfusion.com/forums/181344/essential-studio-2023-volume-1-main-release-v21-1-35-is-available-for-download "Essential Studio 2023 Volume 1") release, we introduced a new [Masked Entry control for the .NET MAUI](https://www.syncfusion.com/maui-controls/maui-masked-entry ".NET MAUI Masked Entry control") platform. This control is designed specifically for .NET MAUI apps, making it a perfect fit for developers building cross-platform mobile apps.

The new .NET MAUI Masked Entry is a text input control that restricts the user’s input to certain characters using a mask pattern. As the user types, the control applies the mask to the input, automatically formatting it according to the pattern. It is used to create templates for providing information such as telephone numbers, email IDs, IP addresses, and product keys.

In this article, we will see the key features of the new .NET MAUI Masked Entry control and the steps to get started with it.

## Key features

The .NET MAUI Masked Entry control supports many user-friendly features:

- [Mask types](#masktypes)
- [PromptChar](#promptchar)
- [Formatting value](#formattingvalue)
- [Cultures](#cultures)

###<a name="masktypes">Mask types</a>

There are two types of masks, simple and regex. Each has a different set of mask elements that combine to form a mask expression.

#### Simple

You can generate expressions with simple mask elements. This is mainly used for fixed-length inputs.
<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/04/NET-MAUI-Masked-Entry-control-with-a-simple-mask-pattern.gif" alt=".NET MAUI Masked Entry control with a simple mask pattern" style="width:100%">

  <figcaption>.NET MAUI Masked Entry control with a simple mask pattern</figcaption>

</figure>

#### Regex

Use regex masks to create more complex expressions for input data.
<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/04/NET-MAUI-Masked-Entry-control-with-regex-mask.gif" alt=".NET MAUI Masked Entry control with regex mask" style="width:100%">

  <figcaption>.NET MAUI Masked Entry control with regex mask</figcaption>

</figure>

###<a name="promptchar">PromptChar</a>

You can customize the default prompt character (\_), which is displayed in the absence of input.
<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/04/Customizing-the-default-PromptChar-in-.NET-MAUI-Masked-Entry-control.png" alt="Customizing the default PromptChar in .NET MAUI Masked Entry control" style="width:100%">

  <figcaption>Customizing the default PromptChar in .NET MAUI Masked Entry control</figcaption>

</figure>

###<a name="formattingvalue">Formatting value</a>

The Masked Entry control provides the following options to format the input values with literals, prompts, and typed characters:

- **ExcludePromptAndLiterals** : Excludes the prompt and literal characters, preserving only the typed characters.
- **IncludePrompt** : Keeps typed and prompt characters and excludes the literals.
- **IncludeLiterals** : Keeps typed and literal characters and excludes the prompt characters.
- **IncludePromptAndLiterals** : Keeps typed, prompt, and literal characters in the input.

Refer to the following images.
<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/04/Excluding-prompts-and-literals-in-the-input.png" alt="Excluding prompts and literals in the input" style="width:100%">

  <figcaption>Excluding prompts and literals in the input</figcaption>

</figure>

<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/04/Including-prompts-in-the-input.png" alt="Including prompts in the input" style="width:100%">

  <figcaption>Including prompts in the input</figcaption>

</figure>

<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/04/Including-literals-in-the-input.png" alt="Including literals in the input" style="width:100%">

  <figcaption>Including literals in the input</figcaption>

</figure>

<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/04/Including-prompts-and-literals-in-the-input.png" alt="Including prompts and literals in the input" style="width:100%">

  <figcaption>Including prompts and literals in the input</figcaption>

</figure>

###<a name="cultures">Cultures</a>

You can set a supported culture for special symbols like currency, date, time, group, and decimal separators.
<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/04/Culture-support-in-the-.NET-MAUI-Masked-Entry-control.png" alt="Culture support in the .NET MAUI Masked Entry control" style="width:100%">

  <figcaption>Culture support in the .NET MAUI Masked Entry control</figcaption>

</figure>

**Note:** For more details, refer to the [.NET MAUI Masked Entry control documentation](https://help.syncfusion.com/maui/masked-entry/overview "Getting Started with .NET MAUI Masked Entry control").

## Getting started with the .NET MAUI Masked Entry control

We have seen the key features of the .NET MAUI Masked Entry control. Let’s see how to integrate it into your .NET MAUI app and utilize its basic features.

**Step 1:**  First, create [a .NET MAUI application](https://learn.microsoft.com/en-us/dotnet/maui/get-started/first-app?view=net-maui-7.0&tabs=vswin&pivots=devices-android "Build your first .NET MAUI app documentation").

**Step 2:**  The Syncfusion .NET MAUI controls are available on the [NuGet Gallery](https://www.nuget.org/ "NuGet Gallery"). To add the .NET MAUI Masked Entry control to your project, open the  **NuGet package manager**  in [Visual Studio](https://visualstudio.microsoft.com/ "Visual Studio"). Search for [Syncfusion.Maui.Inputs ](https://www.nuget.org/packages/Syncfusion.Maui.Inputs "Syncfusion.Maui.Inputs NuGet Package")and then install it.

**Step 3:** Register the handler for the Syncfusion core in the  **MauiProgram.cs**  file. Refer to the following code.

```csharp
using Microsoft.Maui;
using Microsoft.Maui.Hosting;
using Microsoft.Maui.Controls.Compatibility;
using Microsoft.Maui.Controls.Hosting;
using Microsoft.Maui.Controls.Xaml;
using Syncfusion.Maui.Core.Hosting;
namespace MaskedEntrySample
{
  public static class MauiProgram
  {
        public static MauiApp CreateMauiApp()
        {
               var builder = MauiApp.CreateBuilder();
               builder
               .UseMauiApp<App>()
               .ConfigureSyncfusionCore()
               .ConfigureFonts(fonts =>
               {
                   fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
               });
               return builder.Build();
         }
  }
}
```

**Step 4:** Add the **Syncfusion.Maui.Core** and **Syncfusion.Maui.Inputs** namespaces to your XAML page.

```xml
xmlns:inputs="clr-namespace:Syncfusion.Maui.Inputs;assembly=Syncfusion.Maui.Inputs"
```

**Step 5:** Then, initialize the Syncfusion .NET MAUI Masked Entry control. For this demo, we are going to use the regex mask type for an email ID field.

```xml
<inputs:SfMaskedEntry x:Name="maskedEntry"
                      WidthRequest="300"
                      MaskType="RegEx"
                      Mask="[A-Za-z0-9._%-]+@[A-Za-z0-9]+\.[A-Za-z]{2,3}"/>
```

After executing the previous code examples, we will get a Masked Entry control like the following image.
<figure>

  <img src="https://www.syncfusion.com/blogs/wp-content/uploads/2023/04/Integrating-the-Masked-Entry-control-into-a-.NET-MAUI-application.png" alt="Integrating the Masked Entry control into a .NET MAUI application" style="width:100%">

  <figcaption>Integrating the Masked Entry control into a .NET MAUI application</figcaption>

</figure>

## GitHub reference

Check out the [.NET MAUI Masked Entry control demos on GitHub](https://github.com/SyncfusionExamples/maui-maskedentry-samples ".NET MAUI Masked Entry control demos on GitHub").

## Conclusion

Thanks for reading! In this blog, we have seen the features of the new [.NET MAUI Masked Entry control](https://www.syncfusion.com/maui-controls/maui-masked-entry ".NET MAUI Masked Entry control") rolled out in the [2023 Volume 1](https://www.syncfusion.com/forums/181344/essential-studio-2023-volume-1-main-release-v21-1-35-is-available-for-download "Essential Studio 2023 Volume 1") release. Check out our [release notes](https://www.syncfusion.com/products/release-history "Syncfusion Release Notes") and [What’s New](https://www.syncfusion.com/products/whatsnew "Syncfusion What’s New page") pages to see the other updates in this release. Try them out and leave your feedback in the comments section below.

If you are not yet a Syncfusion customer, download the [Essential Studio for .NET MAUI](https://www.syncfusion.com/downloads/maui "Free evaluation of the Essential Studio for .NET MAUI") free trial to start evaluating its controls immediately.

For questions, you can contact us through our [support forum](https://www.syncfusion.com/forums "Syncfusion Support Forum"), [support portal](https://www.syncfusion.com/identity/login "Syncfusion Support Portal"), or [feedback portal](https://www.syncfusion.com/feedback/ "Syncfusion Feedback Portal"). We are always happy to help you!

## Related blogs

- [Syncfusion Essential Studio 2023 Volume 1 Is Here!](https://www.syncfusion.com/blogs/post/essential-studio-2023-volume-1.aspx "Blog: Syncfusion Essential Studio 2023 Volume 1 Is Here!")
- [Streamline MAUI Projects with the Syncfusion .NET MAUI Template Studio](https://www.syncfusion.com/blogs/post/dotnet-maui-template-studio.aspx "Blog: Streamline MAUI Projects with the Syncfusion .NET MAUI Template Studio")
- [What’s New in 2023 Volume 1: .NET MAUI Charts](https://www.syncfusion.com/blogs/post/2023-volume-1-dotnet-maui-charts.aspx "Blog: What’s New in 2023 Volume 1: .NET MAUI Charts")
- [Introducing the 7th Set of .NET MAUI Controls and Features](https://www.syncfusion.com/blogs/post/7th-set-of-dotnet-maui-controls.aspx "Blog: Introducing the 7th Set of .NET MAUI Controls and Features")