1 person found this helpful
If the XML changes in a way that forces the binding to refresh then it will undo other changes.
Thanks for the reply.
Yes, it would. However, in the situation I described, the if the XML would change, it would change for both the Price and AlcoholContent nodes at the same time. Nothing like this happens for the Price node. Now, in the
changeSelection(event)function what I'm doing is something like:
Could it be that because I'm changing the Price node first, the binding is triggered for the entire selectedBeer object, so the
desiredAlcoholContentEditor.value property gets reset to
this.PandACFormatter.parseNumber(this.selectedBeer.AlcoholContent)value before the second line from the code above even gets to execute?
Yes, could be. If you put a breakpoint on parseNumber, you should be able to see how often it gets called and why.
That's exactly what was happening. I really went around the problem right as soon as it happened by manually assiging the values on module load and on changes of the NumericSteppers, but I was really thrown off by this behaviour. I guess the XML object is an IPropertyEventDispatcher, and it automatically generated a PropertyChangeEvent when one of its properties was assigned.
In any case, your answer prompted me to study the IEventDispatcher class and the IPropertyEventDispatcher, which in turn helped me improve the design of my program by making one of the objects shared between the modules an IPropertyEventDispatcher.