From 00beae947cb67f449f8108830f6224b608c1087f Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 19 May 2016 11:01:08 +0100 Subject: [PATCH] Only display error adorner after user interaction. Fixes #307. --- .../Controls/Validation/ValidationMessage.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GitHub.UI.Reactive/Controls/Validation/ValidationMessage.cs b/src/GitHub.UI.Reactive/Controls/Validation/ValidationMessage.cs index 896ae5b6dd..bce75e7bd1 100644 --- a/src/GitHub.UI.Reactive/Controls/Validation/ValidationMessage.cs +++ b/src/GitHub.UI.Reactive/Controls/Validation/ValidationMessage.cs @@ -17,6 +17,7 @@ namespace GitHub.UI public class ValidationMessage : UserControl { const double defaultTextChangeThrottle = 0.2; + bool userHasInteracted; public ValidationMessage() { @@ -33,7 +34,7 @@ public ValidationMessage() .Do(CreateBinding) .Select(control => Observable.Merge( - this.WhenAnyValue(x => x.ShowError), + this.WhenAnyValue(x => x.ShowError).Where(x => userHasInteracted), control.Events().TextChanged .Throttle(TimeSpan.FromSeconds(ShowError ? defaultTextChangeThrottle : TextChangeThrottle), RxApp.MainThreadScheduler) @@ -121,6 +122,7 @@ public string ErrorAdornerTemplate void ShowValidateError(bool showError) { IsShowingMessage = showError; + userHasInteracted = true; if (ValidatesControl == null || !IsAdornerEnabled()) return;