//有效值检测 public void CheckValidate() { string errMsg = ""; bool isValid = ContentValidationRule.IsValueValid(ItemConstruct, _Value, out errMsg); ErrorMsg = errMsg; IsShowError = !isValid; ContentRow.SetItemShowError(IsShowError); }
protected override ValidationResult IsValid(object value, ValidationContext context) { ValidationResult result = ValidationResult.Success; ContentItem constructItem = context.ObjectInstance as ContentItem; if (constructItem != null) { string errorMsg = ""; bool isValid = ContentValidationRule.IsValueValid(constructItem.ItemConstruct, value, out errorMsg); if (!isValid) { result = new ValidationResult(errorMsg); } } return(result); }