Edit this page

MaskedNumericInput

The RadMaskedNumericInput represents the basic control that can be used to restrict numeric user input.

In order to use the RadMaskedNumericInput control in your projects you have to add references to the following assemblies:

  • Telerik.Windows.Controls
  • Telerik.Windows.Controls.Input
  • Telerik.Windows.Data

You can find more info here.

Here is a simple definition of a RadMaskedNumericInput control:

[XAML] Example 1: Define RadMaskedNumericInput in XAML

<telerik:RadMaskedNumericInput HorizontalAlignment="Center"
                               Culture="en-US"
                               EmptyContent="Enter digits"
                               InputBehavior="Replace"
                               Mask="#9.2"
                               SelectionOnFocus="SelectAll"
                               TextMode="PlainText"
                               UpdateValueEvent="LostFocus"
                               Value="12345" />

You can further restrict the user input by setting the FormatString property. It uses Standard Numeric Format Strings and Custom Numeric Format Strings to further format the Text property.

[XAML] Example 2: Setting the FormatString property

<telerik:RadMaskedNumericInput Width="200"
                               Margin="20 20 20 10"
                               Culture="en-US"
                               EmptyContent="Enter digits"
                               FormatString="n3"
                               InputBehavior="Replace"
                               Mask="#9.2"
                               SelectionOnFocus="SelectAll"
                               TextMode="PlainText"
                               UpdateValueEvent="LostFocus"
                               Value="12345" />

See Also