Have RadMaskedNumericInput only allow numbers greater than 0

1 Answer 8 Views
MaskedInput (Numeric, DateTime, Text, Currency)
Zack
Top achievements
Rank 1
Zack asked on 09 Sep 2025, 07:22 PM
I've seen code around that will limit RadMaskedNumericInput to be 0 or greater, but I need to exclude 0.

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 10 Sep 2025, 10:22 AM

Hello Zack,

May I ask if it would be possible to set the MaskedInputExtensions.Minimum attached property to 1? This way, the RadMaskedNumericInput element will accept values equal to or higher than 1.

To use it, add the following namespace:

xmlns:maskedInput="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input"

The following code snippet showcases this suggestion's implementation:

<telerik:RadMaskedNumericInput maskedInput:MaskedInputExtensions.Minimum="1"/>

With this being said, could you give this suggestion a try?

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Zack
Top achievements
Rank 1
commented on 10 Sep 2025, 01:39 PM

This does not work as it does not allow numbers between 0 and 1. I specifically need to exclude 0, but allow decimals.
Stenly
Telerik team
commented on 12 Sep 2025, 09:47 AM

Hello Zack,

If this is the case, an alternative suggestion that I could provide would be to add validation to the scenario.

For example, you could apply validation through data annotations as shown below:

WPF MaskedInput - Using DataAnnotation Attributes - Telerik UI for WPF

For this suggestion, you could set the Range attribute as follows:

public class MainViewModel : ViewModelBase
{
    private double? value;

    //Value property is bound to the Value property of the RadMaskedNumericInput.
    [Range(0.000001, double.MaxValue, ErrorMessage = "Value must be greater than 0.")]
    public double? Value
    {
        get { return this.value; }
        set
        {
            this.value = value;
            this.OnPropertyChanged(nameof(this.Value));
        }
    }
}

An alternative approach would be to use the IDataErrorInfo interface to validate the Value property. I attached a sample project showcasing this approach.

Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Zack
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or