NumericUpDown ValueChanged ContentText

8 posts, 0 answers
  1. Jesper
    Jesper avatar
    21 posts
    Member since:
    Oct 2012

    Posted 09 Jul 2014 Link to this post

    Hey,

    I have a NumericUpDown control where Maximum value is set to 39 and Minimum value is set to -39. What im trying to achieve is to show a dialog window when a user has entered more than 39 as value or more than -39 as value and pressed "Enter", for example the value 89. I also have a ValueChanged event where when i debug it, i can see it has a Dependency property called ContentText which works fine for positive numbers but not for negative numbers. For example if i have entered 5555 the ContentText shows the number but if i have entered -5555 the ContentText shows -39 or any other negative number above -39 makes it go back to -39 where it should have shown the current value entered.

    Is this a Telerik bug?.

    Thanks.
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 10 Jul 2014 Link to this post

    Hi Jesper,

    Could you please give us some more details how to reproduce the issue. Because when Maximum and Minimum is set and the user tries to type in bigger/smaller number, the ValueChanged event is not fired, as the value is not changed.
    If you could open a support ticket and send us a sample project and steps to reproduce the issue it will be of great help.

    Looking forward to your reply.

    Regards,
    Konstantina
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Jesper
    Jesper avatar
    21 posts
    Member since:
    Oct 2012

    Posted 14 Jul 2014 Link to this post

    Hey,

    I have made a simple sample project. There is a Maximum value of 39 and a Minimum value of -39. 

    Here is the link to the sample project: http://neets.dk/jml/RadNumericUpDownCustomSample.zip.

    Steps to reproduce the bug:

    1. Enter a positive value above 39 and press enter, for example 125.
    2. Then the MessageBox dialog will show up correctly and tell that this number is out of range.
    3. Now try and type another positive number, for example 532 and press enter.
    4. Now the MessageBox dialog doesn't show even though the entered value is higher than 39. If we keep typing positive numbers and press enter, for example 542 and press enter and 532 and press enter the MessageBox dialog still doesn't show.
    5. But if we then enter a negative number higher than -39 for example -64 then the MessageBox dialog will show up.
    6. If we then enter a negative number again for example -94 and press enter the MessageBox dialog will now not show up again until i type a positive value.

    Conclusion:

    Its seems like it only fires ValueChanged when i enter a positive number and then a negative number or vice versa and so on.

    Thanks.
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 14 Jul 2014 Link to this post

    Hi Jesper,

    The difference when I tested the described scenario was that I had the Value property bound with value set, so the first ValueChanged event was fired during loading.

    Anyway, the described behavior is the expected one. Since at the beginning the value is not set, when you type in something the NumericUpDown sets the value to the Maximum (in case the input is greater). After that when typing in greater value the event is not fired as the value is not set, since the input is invalid. The ValueChanged event is fired again when a negative number is typed in, as this time the value is set to the Minimum. That is why when typing in positive and negative numbers one after another the ValueChanged event is fired as the value is set to the Minimum or Maximum.

    Does this clears out the manner?

    Regards,
    Konstantina
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. Jesper
    Jesper avatar
    21 posts
    Member since:
    Oct 2012

    Posted 14 Jul 2014 in reply to Konstantina Link to this post

    Hi Konstantina,

    Yes, but is there a way to get the ValueChanged event to fire everytime? or is there another way to get the (invalid) value the user has typed?.
  7. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 15 Jul 2014 Link to this post

    Hi,

    You could hook to the TextInput event which is fired on every key stroke. Then capture when the Enter key is hit and get the exact text at that moment.

    Is that working for you?

    Regards,
    Konstantina
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  8. Jesper
    Jesper avatar
    21 posts
    Member since:
    Oct 2012

    Posted 15 Jul 2014 in reply to Konstantina Link to this post

    Hi,

    thanks, but unfortunately this doesn't work if you enter a value and click with the mouse outside of the RadNumericUpDown control so it loses focus. But thanks for your help, we will try to find another way to solve this. 
  9. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 16 Jul 2014 Link to this post

    OK, please let me know if I can be of further help.

    Regards,
    Konstantina
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WPF is Visual Studio 2017 Ready