c# - ReactiveValidatedObject with DataAnnotation force revalidation of property -
i trying validate property if property set true. using requiredifattribute taken webpage.
[requiredif("propertya",true)] public string propertyb {           {         return _propertyb;     }     set       {         this.raiseandsetifchanged(x => x.propertyb, value);     } } requiredif attribute checking if propertya set true validate otherwise skips validation , return success. it's working charm problem works if propertyb changed doesn't know needs refresh when propertya changed. trying force update when propertya changed this:
this.observableforproperty(x => x.propertya).subscribe(obj => {   this.raisepropertychanged(x=>x.propertyb); }) but doesn't work - nothing happens. think it's ignored because value has not changed.
there approach works rather workaround solution:
this.observableforproperty(x=>x.propertya).subscribe(obj => {  var temp = propertyb;  propertyb = "anything"; //it forces revalidation  propertyb = temp; // forces revalidation }) 
i hope binding propertya propertyb in case.
Comments
Post a Comment