New to Telerik UI for WinUI? Download free 30-day trial

Key Properties

This article lists the key properties of the RadMaskedInput controls.

Mask

The Mask property is a string of characters that constrain user input. The Mask property may contain literals and special mask characters.

Use the backslash "\" character to escape any mask characters so that they display as literals. At runtime, any blank space occupied by a mask character is displayed as the PromptChar property character.

Value, Text and ValueFormat

The Value property returns user input without the formatting characters. If you want the input and the formatting characters, use the Text property instead.

If you want to allow the value to hold also literals and prompt characters, you can enable this by setting the ValueFormat property of the control.

Header, HeaderTemplate and Description

Similarly to other controls, the RadMaskedInput controls expose the Header and HeaderTemplate properties which allow you to display a header on top of the control and also specify a DataTemplate for it in which you can create a more complicated layout.

In addition, you can also define a Description which will be displayed beneath the control.

Example 1: Setting the Header, HeaderTemplate and Description

<telerik:RadMaskedTextInput Mask="###" Header="Header" Description="Description of this input"> 
    <telerik:RadMaskedTextInput.HeaderTemplate> 
        <DataTemplate> 
            <StackPanel Orientation="Horizontal"> 
                <Ellipse Fill="Red" Width="10" Height="10" Margin="5" /> 
                <TextBlock Text="{Binding}" /> 
            </StackPanel> 
        </DataTemplate> 
    </telerik:RadMaskedTextInput.HeaderTemplate> 
</telerik:RadMaskedTextInput> 
WinUI RadMaskedInput Header, HeaderTemplate and Description

Empty Text

the EmptyText property determines the text that will be displayed, when the Value of the control is null.

Example 2: Setting the EmptyText property

<telerik:RadMaskedTextInput Mask="####" EmptyText="Please Enter Four Digits" /> 
WinUI RadMaskedInput Setting the EmptyText property

Allow Null Values

By default the RadMaskedInput controls don't allow you to set null as their Value. Instead the null value is coerced. To alter this behavior and allow null values you can set the AllowNullValue property to True.

Example 3: Setting AllowNullValue property

<telerik:RadMaskedTextInput AllowNullValue="True" /> 

Allow Prompt as Input

Via the AllowPromptAsInput property you can control whether the prompt character should be treated as a valid input character or not.

Please note that even when AllowPromptAsInput is True, the prompt character must be valid for the current location in the mask in order to be accepted. For example, if PromptChar is "*", and the current location in the mask demands the user enter a digit, entering an asterisk (*) will fail.

Culture

The RadMaskedInput controls provides full globalization support out-of-the-box through the Culture property. Read more about this in the Culture article.

IsReadOnly

The IsReadOnly property determines if the user can change the text in the control.

See Also

In this article
Not finding the help you need?