lets bind sfnumericupdown and add ivalueconverter. then, place breakpoints on Convert and ConvertBack methods and debug.
we see, that on init, firstly will be called Convert and then immidiately convertback.
in some situation it brings the recursive or event infinite side effect.
i am writing metric to imperial weights converter..for simplicity internal storage is in gramms, 4 digits after decimal point.
but when i output data to user, i show only 1 digit, after decimal point.
lets say we have 40 kg
1. convert called with object value 40, it is converted to 88.185 lbs and output to control as 88.2 lbs
2. immidiately convertback called with value 88.2 which converts back and, surprise, it is 40.0068
3. now you update source with this new value, which effectively overcome simple check if (weight == value) return;
4. source updates with new value and send new notifypropertychanged,
5. which effectively brings us to item 1 of this sequence with the value 40.0068 and this will continue until it reaches the value which converts without rounding ;)
this sample is not to discuss how to write metric to imperial conversion. i just wonder , what is the reason to update
source immidiately after reading it ?
i think that this is wrong behaviour . you should not update source when control value just changed from source.