public static IObservable <ValidationErrorEventArgs> ObserveValidationErrors(this INotifyValidationError validable, string property) { if (validable == null) { throw new ArgumentNullException("validable"); } if (property == null) { throw new ArgumentNullException("property"); } return(Observable.FromEventPattern <EventHandler <ValidationErrorEventArgs>, ValidationErrorEventArgs>( o => validable.ErrorsChanged += o, o => validable.ErrorsChanged -= o) .Where(c => property == c.EventArgs.PropertyName) .Select(c => c.EventArgs)); }
public static Task <bool> HasError <T>(this INotifyValidationError validable, Expression <Func <T> > property) { return(validable.HasErrorAsync(property.GetPropertyName())); }
public static IObservable <ValidationErrorEventArgs> ObserveValidationErrors <T>(this INotifyValidationError validable, Expression <Func <T> > property) { return(validable.ObserveValidationErrors(property.GetPropertyName())); }