wpf Datagrid :which Validation method is best for datagrid -


i want validate datagrid cell namely item column when user input against database table itemmaster .my doubt method best me validate input ,validationrule or idataerrorinfo ?

this question 100% duplicate. have found answer yourself.

use idataerrorinfo because able validate input inside viewmodel able access values/properties/data if needed validation.

futhermore able swap viewmodels , change validation not able achieve validationrules easly.

validation of viewmodel properties should done in viewmodel. centralized , testable. shouldnt not become part of view except has whatever reason.

you should use validationrules when have binding between 2 control properties in scenario validation belongs "view" anyways , stays inside view part of mvvm.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -