Data annotation and wpf validation
问题 Is there any way that I use data annotation as the source of validation in WPF? I want to be able to define a class such as: class myData { [Required] [MaxLength(50)] public string Name{get;set;} } And then bind it to a field in a view and the wpf validate that user enter some value for this field and also make sure that its length is not greater than 50. I know that I can write a validator for this, but then if I change the maxLength to say 60, then I need to change it in validator and I don