If I have a WPF control bound to a data source and set the ValidatesOnExceptions to true on the Binding object. Now if I write something in the control that cannot be converted to the source's data type, I will get a validation error and a red border on my control.
But if I set an incompatible value on the source, the exception is silently caught in the binding and a default value is returned. No indication exists that the value in the control cannot be trusted, because of the binding error.
How can I visualize the binding problems to the user, regardless of which side is the cause of it? I want the user to know that the value in the control is not reliable.
MORE INFO:
This is what I have in the trace. It tells me that an OverflowException is thrown during conversion (because 99999 does not fit into an Int16). Then it simply uses 0 instead of 99999 when setting the value on the target. That's ok, I don't expect it to do the impossible. The problem is that it does not give me an option to act on the error and there are no validation errors to be found.
Got PropertyChanged event from DataClass (hash=2616333)
GetValue at level 0 from DataClass (hash=2616333) using RuntimePropertyInfo(Int32): '99999'
TransferValue - got raw value '99999'
A first chance exception of type 'System.OverflowException' occurred in mscorlib.dll
System.Windows.Data Error: 6 : 'SystemConvertConverter' converter failed to convert value '99999' (type 'Int32'); fallback value will be used, if available. BindingExpression:Path=Int32; DataItem='DataClass' (HashCode=2616333); target element is 'AliasClass' (HashCode=32866918); target property is 'Int16' (type 'Int16') OverflowException:'System.OverflowException: Value was either too large or too small for an Int16.
TransferValue - implicit converter produced {DependencyProperty.UnsetValue}
TransferValue - using fallback/default value '0'
TransferValue - using final value '0'