.NET 4.0中的ConversionValidationRule [英] ConversionValidationRule In .Net 4.0

查看:82
本文介绍了.NET 4.0中的ConversionValidationRule的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框,该文本框绑定到可为null的int属性.我只是将我的应用程序转换到.Net 4.0,现在当我在文本框中输入数字然后删除它时,出现类型为System.Windows.Controls.ConversionValidationRule的验证错误.  在运行时发生验证错误时,我可以看到绑定没有与之关联的任何验证规则,因此.Net 4.0中似乎有些东西会在后台自动创建验证规则.  何时 我将项目切换回.Net 3.5,此问题消失了.   .Net 4.0中还有其他人注意到吗?  有没有办法关闭此自动验证功能?

I have a text box that is bound to a nullable int property.  I just converted my application over to .Net 4.0, and now when I enter a number into the textbox and then delete it I get a validation error of type System.Windows.Controls.ConversionValidationRule.  When the validation error occurs at runtime I can see that the binding does not have any validation rules associated with it, so it looks like there is something in .Net 4.0 that is automatically creating a validation rule behind the scenes.  When I switch my project back to .Net 3.5 this issues goes away.  Has anyone else noticed this in .Net 4.0?  Is there a way to turn this automatic validation off?

 

谢谢

推荐答案

检查您是否没有返回DependencyProperty.UnsetValue的转换器.
Check that you don't have any converters returning DependencyProperty.UnsetValue.


这篇关于.NET 4.0中的ConversionValidationRule的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆