c# - Nested validation not updating on child VM change -
i have scenario nested model want validation on.
since ui implementing drag , drop behavior mvvm, , don't want put logic in model, there vm of model classes.
for example siteconfiguration
has vm named siteconfigurationviewmodel
.
in such case, siteconfigurationviewmodel
has property of type siteconfiguration
exposes model.
the root vm contains list of top level vms , view (datawindow
) has binding show list (listview
) of vms instances , selected instance user can edit.
i trying implement validation when change values in nested vm/model, top window errors not updated.
i tried many variations (e.g. validation annotations, overriding validatefields
, validatebusinessrules
, viewmodeltomodel
attribute) guess doing wrong.
if add errors model (and not view model), errors won't show automatically. reason catel adds warninganderrorvalidator control view model you, not model (because might want hide validation). note vm responsible validation.
if use viewmodeltomodel mappings, catel automatically map validation (so can validate on model, map on vm , vm automatically expose mapped warnings / errors).
Comments
Post a Comment