Restrict input to positive numbers up to max value only

Hello,

I use an SfNumericEntry so that the user can only enter numbers according to the following specification:

 Only positive numbers (Minimum 1) up to 9999 without any grouping sign, e.g. thousands separator

If've setup the control like so:

 <input:SfNumericEntry TextColor="White"
                       FontSize="18"
                        AllowNull="False"
                       SelectAllOnFocus="True" 
                       CustomFormat="N0" 
                       MaximumNumberDecimalDigits="0" 
                       Minimum="1" 
                       Maximum="9999"
 />

But I'm still able to input a negative sign 

Image_9252_1778151814792

and numbers much higher/lower then specified.

 Only when the control loses focus the input is corrected to the max/min value, except that a thousand separator is added.

Image_5912_1778152075734


So, how can I :

1) Avoid that the user can type in values outside of the specified range? In this case the user shouldn't be able to type more than 4 digits

2) Avoid the negative sign?

3) Avoid thousand separator?


Thanks alot for your help!

Regards,

Michael


5 Replies

KJ Kishore Jeyachandran Syncfusion Team May 8, 2026 10:39 AM UTC

Hi Michael,

 

Thank you for your detailed query.

 

By default, SfNumericEntry validates and formats its value only when the control loses focus, which is why you can temporarily enter negative values or numbers outside the specified range. However, this behavior can be changed by enabling immediate value updates while the control is focused.

 

This can be achieved using the ValueChangeMode property.

XAML Code :
 

<input:SfNumericEntry

    TextColor="White"

    FontSize="18"

    AllowNull="False"

    SelectAllOnFocus="True"

    Minimum="1"

    Maximum="9999"

    MaximumNumberDecimalDigits="0"

    ShowGroupingSeparator="False"

    ValueChangeMode="OnKeyFocus" />

 

With this configuration:

  • Only positive numbers between 1 and 9999 can be entered
  • Negative values are restricted
  • Thousand separators are not displayed
  • Validation and value updates occur while the control is focused

 

We hope this addresses your requirements clearly. Please feel free to reach out if you need any additional clarification or a sample project demonstrating this setup.

 

Regards,

Kishore J



MI Michael replied to Kishore Jeyachandran May 8, 2026 11:57 AM UTC

Hi  Kishore,


thanks for your reply. Your suggested solution workes fine, except for the thousand separator.

Your XAML code shows a property   

ShowGroupingSeparator="False"

 which doesn't seem to exist in my version 33.2.4.

Am I doing something wrong?


Regards

Michael



SS Shyam Sundar Datchina Moorthy Syncfusion Team May 11, 2026 01:28 PM UTC

Hi Michael,

 

Sorry for the confusion and any inconvenience caused earlier.

 

The ShowGroupingSeparator property is not available in the SfNumericEntry. Thank you for pointing this out.

 

We’ve now updated and shared a corrected sample that demonstrates how to achieve the expected behavior without the thousand separator, using the valid configuration supported in this version. Kindly review the updated sample for reference.

 

Please feel free to modify the sample to better match your scenario, and let us know if the issue still reproduces. We’ll be happy to investigate further if needed.

 

Thank you for your understanding.

 

Regards,

Shyam Sundar D


Attachment: NumericEntrySample_9dabd950.zip


MI Michael May 11, 2026 05:39 PM UTC

Thanks alot! That solves it.


Regards

Michael



PR Preethi Rajakandham Syncfusion Team May 12, 2026 04:41 AM UTC

Hi Michael,

You are welcome. 
We are glad to know that the reported problem has been resolved. Please let us know if you require any further assistance on this. We will be happy to assist you.

Regards,
Preethi R


Loader.
Up arrow icon