How to change error message of IntergerUpDown

Apr 29, 2013 at 9:53 AM
Hi,

All is in the title. For exemple if the user enter a value higher than the maximum, the message is
"Value must be less than MaxValue of 12. Nom du paramètre : Maximum". Impossible to change that without rewrite CommonNumericUpDown.

Thanks.
Coordinator
May 13, 2013 at 2:24 PM
Are you refering to the message of the ArgumentOutOfRangeException provided as part of the InputValidationErrorEventArgs when UpDownBase.InputValidationError is raised ?
May 14, 2013 at 7:46 AM
Yes exactly. Here what i do :
public void Editor_InputValidationError(Object sender, InputValidationErrorEventArgs e)
        {
            System.Windows.MessageBox.Show(e.Exception.Message);
        }
Coordinator
May 14, 2013 at 2:18 PM
Edited May 14, 2013 at 2:19 PM
My best guess to localize this string would be to interpret the exception itself and re-create the message (did not check the code-compilation, may have some errors, typos):
public void Editor_InputValidationError(Object sender, InputValidationErrorEventArgs e)
 {

           var outOfRange = e.Exception as ArgumentOutOfRangeException;
           if(outOfRange.ParamName == "Maximum")
              // Localize the error message
             System.Windows.MessageBox.Show("this_is_the_localized_string");

           //...same for Minimum...

}
May 14, 2013 at 3:12 PM
Ok thanks i'll do like this ;)