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
450
XamNumericInput validation issues
posted

I have a problem with multiple XamNumericInputs that trigger validation with each other through a central IDataErrorInfo-ed ViewModel. I'm not sure if I'm doing this correctly, but for most other situations it works, this just seems to happen with the numericinputs (and MaskedTextEditor, for that matter).

What happened is this: I have 2 numbers that need to be validated against each other. One (call it x) must be larger than the other (call that y). Triggering a change in y triggers the OnPropertyChanged event for x manually (this part may not be wisely done) in order to trigger validation. If validation fails, the error for x's editor displays an appropriate tooltip.

In effect, I'm trying to ensure that if I enter a larger value into y, or change x to become smaller than y, x's numericinput should display an error. I've made both inputs' ValidatesOnDataErrors & NotifyOnValidationError properties True, with UpdateSourceTrigger=PropertyChanged.

This happens correctly on the very first time the error triggers (e.g. set y to '10' while x is '0'), but on the very next keystroke (e.g. setting y to '110') the validation disappears. I noticed that the validation highlight appears for an instant, then it disappears again. This happens more often when x is 0 than if it were a larger number, and using Snoop also gave the impression that the error continued to trigger, but then was masked off.

What do I need to do to fix this?