Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVVM model validation and data binding?

When looking up tutorials for the best practices to do property validation in WPF MVVM I see a lot of people use the interface IDataErrorInfo I was just wondering if it is possible to setup automatic validation like that used in ASP .Net MVC using attributes?

Can anyone sugest what the best practices are for model validation in MVVM? Should the validation be on the base model class? or on the view model class?

like image 392
Alex Hope O'Connor Avatar asked Aug 13 '26 07:08

Alex Hope O'Connor


1 Answers

Silverlight has a control called the DataForm that works using the DataAnnotations Attributes and someone was kind enough to port that control to WPF. I believe that is something along the lines of what you're looking for.

like image 132
Michael Brown Avatar answered Aug 16 '26 14:08

Michael Brown