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
300
Why doesn't the XamGrid treat ValidationExceptions, or Exceptions as validation?
posted

I'm working with the XamGrid, and I am using a custom Validation Attribute that I created. This attribute throws a Validation exception when there are problems with the value being set for a property. The XamGrid doesn't handle this like other Validation Attributes, and instead of catching the Exception or ValidationException it ends up being handled by the Application.

Is there a way to indicate to the XamGrid to validate on Exceptions, as if I were setting that option within the Binding?

Below is the code that throws the exception.

double Value = (double)0;

            try
            {
                if (value.GetType() != typeof(decimal))
                {
                    Value = (double)value;
                }
                else
                {
                    Value = Convert.ToDouble(value);
                }

                if (Value >= this.Minimum)
                {
                    return ValidationResult.Success;
                }
                else
                {
                    throw new ValidationException(string.Format(this.ErrorMessage != null ? this.ErrorMessage : "The entered value must be greater than {0}.", this.Minimum.ToString()));
                }
            }
            catch (InvalidCastException)
            {
                throw new ValidationException(this.ErrorMessage != null ? this.ErrorMessage : "The entered value must be numeric.");
            }

 

XamGrid Version 10.3

Parents Reply Children
No Data