internal void UpdateIsValid() { var q = Items.SelectMany(x => x.Fields); var isValid = true; foreach (var item in q) { var error = AtomValidationRule.Validate(item); if (error != null) { isValid = false; } } SetValue(IsValidPropertyKey, isValid); }
/// <summary> /// /// </summary> /// <param name="propertyName"></param> protected override void OnPropertyChanged([CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); if (propertyName == "IsFocused") { if (!this.IsFocused) { // we just lost the focus?? // lets validate this textbox... if (AtomForm.GetError(this) != null) { AtomValidationRule.Validate(this); } } } }
private static void OnValidatorChanged(BindableObject bindable, object oldValue, object newValue) { AtomPropertyValidator v = newValue as AtomPropertyValidator; if (v == null) { return; } bindable.PropertyChanged += (s, e) => { var error = AtomForm.GetError(bindable); if (string.IsNullOrWhiteSpace(error)) { return; } if (e.PropertyName == v.BindableProperty?.PropertyName || e.PropertyName == v.Property) { AtomValidationRule.Validate(bindable as View); } }; }