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.
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.