Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1960
Set MinValue and MaxValue when displayed text doesn't match the editor's underlying value
posted

Hello,

I created a "UOMEditor" control that inherits from the UltraNumericEditor.

Based on the user preferences, the control displays length in inches or millimiters. So, when the database stores a value of 1 and the user has the system configured to "English System", the control displays "1.00 in". If the user prefers the "Metric System", the control displays "25.4 mm", but the database always stores 1.

I implemented this by applying a DataFilter on my UOMEditor. If the current configuration is Metric System, the value is multiplied by 25.4 when the conversion direction is OwnerToEditor and divides by 25.4 when the direction is EditorToOwner.

The conversion works fine, but I'm having a problem with the MinValue and MaxValue. In the attached sample project the default measure system is English. The MinValue is 1 and the MaxValue is 100. Th UOMEditor displays 1.00 inches.

If you change the UOM value with the up and down arrows, the maximum value is 100, and the minimum is 1. So far so good because this is the trivial case where there is no conversion involved.

Now change the measure system to Metric. The UOM changes to 25.4 mm. The Minvalue and MaxValue are always represented in inches, so they remain at 1 and 100.

Now change the UOM value with the up arrow key. The maximum value is 100, which is wrong. It should be 2540 (100 inches * 25.4 mm/inches). Now decrease the value with the down arrow key. The minimum value is 1, which is also wrong. It should be 25.4 (1 inches *25.4 mm/inches). Keep the vaue of 1.00 in the editor and tab out. The control won't let you unless the value is 25.4 or more. That means the internal validation works as expected and it converts the displayed value from 25.4 to 1.00 before comparing it to the minimum value of 1.00.

To sum it up, the internal validation when tabbing out of the control works as expected, but the validation when the editor text changes doesn't.

Is there a way to alter the min and max value validation process when the text changes?

Thanks.

UOMEditorSample.zip
Parents
  • 469350
    Offline posted

    What version of the controls are you using? Are you using the latest Hot Fix? If not, I suggest you download it and see if that helps. I'm pretty sure this issue was fixed a while ago.

    If that does not help, then you should Submit an incident to Infragistics Developer Support so they can check this out. Clearly, if the control recognizes the correct MinValue/MaxValue when you try to tab out of it, but not when you are spinning the value, then that's a bug and needs to be corrected.

Reply Children