protected override void ValidateCore(Property property, string value, IList<ValidationResult> results) { var elementProperty = property as ElementProperty; if (elementProperty == null) return; var lowerBoundTypeProperty = elementProperty.DeclaringElement.Properties.Single(p => p.PropertyName == "LowerBoundType"); var upperBoundTypeProperty = elementProperty.DeclaringElement.Properties.Single(p => p.PropertyName == "UpperBoundType"); if (((RangeBoundaryType)lowerBoundTypeProperty.Value) == RangeBoundaryType.Ignore || ((RangeBoundaryType)upperBoundTypeProperty.Value) == RangeBoundaryType.Ignore) { return; } IComparable senderBound = (IComparable)property.ConvertFromBindableValue(value); IComparable boundToCheck = GetOtherBoundary(elementProperty); bool isInvalid; if (property.PropertyName == "UpperBound") { isInvalid = CheckBounds(senderBound, boundToCheck); } else { isInvalid = CheckBounds(boundToCheck, senderBound); } if (isInvalid) { results.Add(new PropertyValidationResult(property, string.Format(CultureInfo.CurrentCulture, Resources.RangeBoundValidatorErrorMessage))); } }
protected override void ValidateCore(Property property, string value, IList<ValidationResult> results) { var internalValue = (string)property.ConvertFromBindableValue(value); if (string.IsNullOrEmpty(internalValue)) { results.Add(new PropertyValidationResult(property, Resources.DatabaseSettingsDoesntHaveDefaultDatabase, true)); } }