namespace GDNXFD.Alert.Config.Validations { using System; using System.Windows.Controls; /// /// Rule for required fields /// public class RequiredValidationRule : ValidationRule { /// /// When overridden in a derived class, performs validation checks on a value. /// /// The value from the binding target to check. /// The culture to use in this rule. /// /// A object. /// public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null || String.IsNullOrWhiteSpace(value.ToString())) { return new ValidationResult(false, "不能为空!"); } return new ValidationResult(true, null); } } }