开发者

Customization of wrong format validation error messages in Silverlight & Wpf

Error messages associated with Validation attributes such as [Required] can be easily customized and localized either by providing directly the message string or a resource containing the message.

However, is it possible to customize the error message produced by Silverlight or Wpf when they are not able to convert the string in an input field into the type of the property the input field is bound to?

I have not found a clean way to do it! Also if you write your own converter and attach it to the binding,开发者_Python百科 you are not able to produce a different message because Silverlight and Wpf only catch the exceptions produced by its standard converter. Exceptions thrown in user defined converters are not used to produce error messages but they just cause the application be aborted.

Does anyone knows a way to solve this issue?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜