public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (!IsChecked) { yield return(ValidationErrorFactory.CreateValidationResult <TestViewModel7>(validationContext, "Value is required when the field is checked!", vm => vm.IsChecked)); } }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { yield return(ValidationErrorFactory.CreateValidationResult(this, "Error", t => t.AnotherProperty.EnumProperty, t => t.RenamedProperty)); }