Configuring Incorrect Format Validation Error Messages in Silverlight & Wpf

Error messages associated with validation attributes, such as [Required], can be easily configured and localized either by directly passing a message string or a resource containing this message.

However, is it possible to customize the error message generated by Silverlight or Wpf when they cannot convert the string in the input field to the type of property that the input field is bound to?

I did not find a clean way to do this! In addition, if you write your own converter and bind it to the binding, you cannot create another message, because Silverlight and Wpf will only catch exceptions from the standard converter. The exceptions set in custom converters are not used to generate error messages, but they simply cause the application to interrupt.

Does anyone know a way to solve this problem?

+5
source share
1 answer

The problem of the converters you mentioned is reported only in the Wpf documentation. Exceptions thrown in the Silverlight IValueConverter.ConvertBack method must be converted to a validation error

+2
source

All Articles