Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法使用WPF中属于System.ComponentModel.DataAnnotations命名空间的验证程序类_C#_.net_Wpf_Validation - Fatal编程技术网

C# 无法使用WPF中属于System.ComponentModel.DataAnnotations命名空间的验证程序类

C# 无法使用WPF中属于System.ComponentModel.DataAnnotations命名空间的验证程序类,c#,.net,wpf,validation,C#,.net,Wpf,Validation,我无法在WPF中使用属于System.ComponentModel.DataAnnotations命名空间的验证程序类。不知道验证器类是否与该DLL一起提供。我正在使用.NET4.5框架。根据Microsoft发行说明,验证程序类可以从.NET4.0版本使用,我使用的是更高版本 我知道有些愚蠢的事情被错过了。非常感谢您的帮助。这个问题最简单的答案是添加System.ComponentModel.DataAnnotations DLL作为项目的参考 这让我很惊讶。using语句(使用System.

我无法在WPF中使用属于System.ComponentModel.DataAnnotations命名空间的验证程序类。不知道验证器类是否与该DLL一起提供。我正在使用.NET4.5框架。根据Microsoft发行说明,验证程序类可以从.NET4.0版本使用,我使用的是更高版本


我知道有些愚蠢的事情被错过了。非常感谢您的帮助。

这个问题最简单的答案是添加System.ComponentModel.DataAnnotations DLL作为项目的参考

这让我很惊讶。using语句(使用System.ComponentModel.DataAnnotations;)没有抛出任何错误,即使项目中没有添加System.ComponentModel.DataAnnotations DLL的引用。但唯一的问题是验证器类不可用

在我添加DLL的那一刻,我就能够使用验证器类了。以前只有在我使用Using语句而不添加DLL时,它不应该是一个错误吗?或者,它是已知的bug吗?或者,我又错过了什么吗?

您应该能够使用。你到底犯了什么错误。请附上截图。