Using infragistics UltraNumericEditor, if I set the .MaxValue to 50, the control will allow me to enter decimals larger than the limit (for example, 50.99)
I see the same behavior if I set the .MaxValue property to 50.01 (can set values larger)
I can obviously resolve this in code but resetting the value, but it seems like the control should do this on its own.
Is there something I’m missing in how to use these properties correctly?
The problem was a result of the
IEditorDataFilterfor percentage values.Infragistics recommends, and I had implemented, an
IEditorDataFilterwhich converts decimal percentages (.5 = 50%) into percentages for display.This filter is applied before the validation for the control takes place. Therefore, setting the
MaxValueto “50” allowed me to enter “50.99” but not “51”… normally this would have caused a validation error as per Steve’s answer. However, because of theIEditorDataFilterapplied to this control, the value was automatically converted to .5099 and this new value does not violate the constraint.The solution I implemented was to check the value in the
Validatedevent to see if it was larger than theMaxValue/ 100, and if so to set it equal to the same.