I had a similar problem when using a value converter and MVVM template. The problem was with setting the value in the data binding model in the model. The binding is fired, and the exchangedevent property is raised. Thus, the value has already been changed, and then the converter received a call.
If you change an event with a changed function, and then call it, it throws an unhandled exception, even if you set ValidatesOnException to true. This is due to the fact that the binding has already been updated as a result of triggering an event with a changed property. The converter then starts and throws an exception, but the control cannot catch it.
I moved the logic from the converter to perform a check in the viewModel binding property adjuster. Only if the data was valid, I had to run NotifyPropertyChangedEvent. Otherwise, I would choose an exception that will be displayed in the user interface using the ValidatesOnException property for the binding.
Hope this helps.
source share