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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -