The .NET WinUI MaskedTextBox is an advanced input control that restricts the input of certain characters, text, and numbers by using a mask pattern. This control is used to create templates for providing information such as telephone numbers, email IDs, IP addresses, product keys, and so on.
The WinUI MaskedTextBox control provides two types of masks: simple and regex. Each has a different set of mask elements that are combined to form a mask expression.
Generate expressions with very simple mask elements. This is mainly used for fixed-length inputs.
Use regex masks to create more complex expressions for input data.
The WinUI MaskedTextBox control provides the option to format input values with literals and prompt characters.
Set up the MaskedTextBox to exclude prompt and literal characters, preserving only the typed characters.
Maintain typed, prompt, and literal characters in the input.
Set up the MaskedTextBox to preserve typed and prompt characters, excluding literals.
Keep typed and literal characters in the input but exclude prompt characters.
Special symbols like currency symbols, date separators, decimal separators, and others are applied based on the specified culture.
The WinUI Masked TextBox control indicates errors by displaying an icon with additional details when hovering the cursor over the icon.
Some built-in error types are provided: default, critical, warning, information, and success.
Users can customize the error icon and the border brush for indication.
Show additional information when hovering the cursor over the error icon.
WinUI MaskedTextBox provides customization support for the header, header template, and description.
The header is used to display the title for the MaskedTextBox control.
The header template is used to customize the appearance of the control’s header.
The description is used to display content beneath the control and provide guidance on the input that the control expects.
Easily get started with the WinUI MaskedTextBox using a few simple lines of XAML and C# code as demonstrated below. Also explore our WinUI MaskedTextBox example that shows you how to render and configure the control.
<Page
x:Class="GettingStarted.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:GettingStarted"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:syncfusion="using:Syncfusion.UI.Xaml.Core"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<syncfusion:SfMaskedTextBox MaskType="Simple" Mask="00/00/0000"/>
</Grid>
</Page>
// Creating an instance of the MaskedTextBox control.
SfMaskedTextBox maskedTextBox = new SfMaskedTextBox();
// Adding the mask type to the control.
maskedTextBox.MaskType= "Simple";
//Setting the mask value of the control.
maskedTextBox.Mask="00/00/0000";
Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.