RadMaskedTextInput represents a control that can be used to restrict the input of text values.

Defining RadMaskedTextInput

The following example shows how to define the control and set few of its properties.

Example 1: Define RadMaskedTextInput in XAML

<telerik:RadMaskedTextInput EmptyContent="Enter digits" 
                            Value="Sample Text" /> 

Figure 2: RadMaskedTextInput example

Formatting the Value

You can format the entered value using the FormatString property of the RadMaskedTextInput control.

The property works with the standard .NET string formats.

The format will be applied only when the control is unfocused.

Example 2: Setting the FormatString property

<telerik:RadMaskedTextInput Value="Adam" 
                            FormatString="{}UserName: {0} NickName: {0}"/> 

Figure 2: Showing the text value when the control is focused

Figure 3: Showing the text value when the control is unfocused

Setting the Value Mode

The value mode allows you to set the behavior of the Value property in a mask scenario (when the Mask property is set). By default the Value property holds the characters without including the placeholders and the literals defined in the mask. You can alter this and allow the value to hold also literal and placeholders by setting the ValueMode property of the control.

Read more about this in the Value Mode article.

See Also

In this article
Not finding the help you need? Improve this article