This is a migrated thread and some comments may be shown as answers.

StackOverflow on BindingValidation_Error if arrow keys not textbox used

3 Answers 62 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 27 May 2009, 01:50 AM
Setting a BindingValidation_Error event only works correctly for values entered via the textbox. For the same value entered using the up/down arrow buttons the code goes into a loop, adding and then removing, adding and then removing the error condition.

When an invalid value is set using the text box the event is raised once with ValidationErrorEventAction set to Added. But if the same invalid value is set using the arrow keys the BindingValidation_Error event is raised first with Added, then immediately with Removed, then with Added, then with Removed until a StackOverflow error occurs. 

I'd like to think my code is at fault but can think of no scenario where the way the binding error is handled should be so different just because different parts of the UI are used to set the same invalid value.

This bug is on top of the others discovered so far:
- For currency items the control displays a currency symbol, but although there is a property NumberFormatInfo.CurrencySymbol this property does nothing to the UI when set, making the control useless where you want the user to be able to select the currency they want to use.
- The number of decimal places cannot be set in XAML and has to be set from code. Bizarrely setting it for one Up/Down control appears to set it for all of them!
- The Maximum value must be set before the Minimum value in the XAML or the arrow keys don't work.

3 Answers, 1 is accepted

Sort by
0
Accepted
Boyan
Telerik team
answered on 28 May 2009, 11:17 AM
Hello Ian,

 I was unable to reproduce the problem. Could you please open a support ticket and send a simple project so I can reproduce it?

 About the other issues:

  • There is a with NumberFormatInfo.CurrencySymbol which prevents from setting the proper symbol. We are using Microsoft's class not ours for this. The good thing is that there is two very simple workarounds:
1. You can use CustomUnit property and set whatever you want, for example
numeric1.CustomUnit= "$"       and it will show at the end of the value.

2.Or set :
        CultureInfo culture = new CultureInfo("fr-fr"); 
            radnumeric3.NumberFormatInfo.CurrencySymbol = culture.NumberFormat.CurrencySymbol; 


  • This is known problem, it is on our To Do list and will try to fix it in near future.
  • This is also known, however this appears only when you make your own style and set it to the RadNumericUpDown control, if you don't use style and just add it to the control this issue will not appear. This problem is  part of the Silverlight framework. Creating your own style and setting it to a multiple numeric controls is a good practice to the extent that you save code. Unfortunately, the RangeBase class provided by the Silverlight Framework seems to have some problems with its coercing of Minimum and Maximum values when set in Style

 Thank you for your time and I am waiting for project to try and help with BindingValidationError.

Sincerely yours,
Boyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ian
Top achievements
Rank 1
answered on 28 May 2009, 12:00 PM
Thanks for the response.

I need to cut down the current application to a simple scenario before sending you code and will try and find time to do so over the next day or two, as I'm way behind on other priorities (testing the chart functionality with real data) and may have a workaround for our specific scenario anyway.

Re: the currency symbol I'd developed my own workaround which involved changing the value to be numeric and moving the currency to the corresponding label, but I like your solution better and will probably give it a go when I've made progress on other issues.

Cheers,
Ian
0
Boyan
Telerik team
answered on 29 May 2009, 02:43 PM
Hi Ian,

I am waiting for the code and I will be glad to help. Thank you for your time and efforts. I also added Telerik points for your involvement.

Sincerely yours,
Boyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
NumericUpDown
Asked by
Ian
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Ian
Top achievements
Rank 1
Share this question
or