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?
Hello,
Thank you for your post. I have been looking into it, but it seems like that I am missing something in your scenario, so could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.
Sure, as attached.
There seem to be more problems in this one but the basic issue remains: if I change values on either editors such that 'Smaller' becomes larger than 'Larger', the error shows the first time it triggers, but subsequent editing causes the errors to disappear.
This is difficult because if my user types a series of numbers quickly they wouldn't be able to see exactly why they encountered an error.
Note also that somehow, the 'Smaller cannot be 0' validation does not always trigger, it seems to be that I need to change its value from 0 first.