.NET 4.0中的ConversionValidationRule

编程入门 行业动态 更新时间:2024-10-26 14:30:11
本文介绍了.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 typeSystem.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

本文发布于:2023-11-09 05:21:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571492.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NET   ConversionValidationRule

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!