diff --git a/CefSharp.Wpf/ChromiumWebBrowser.cs b/CefSharp.Wpf/ChromiumWebBrowser.cs index 7ba1bfe8ca..02038372c9 100644 --- a/CefSharp.Wpf/ChromiumWebBrowser.cs +++ b/CefSharp.Wpf/ChromiumWebBrowser.cs @@ -1680,16 +1680,18 @@ private static void OnTooltipTextChanged(DependencyObject d, DependencyPropertyC /// new value protected virtual void OnTooltipTextChanged(string oldValue, string newValue) { - var timer = tooltipTimer; - if (timer == null) + // There are cases where oldValue is null and newValue is string.Empty + // and vice versa, simply ignore when string.IsNullOrEmpty for both. + if (string.IsNullOrEmpty(oldValue) && string.IsNullOrEmpty(newValue)) { return; } - // There are cases where oldValue is null and newValue is string.Empty - // and vice versa, simply ignore when string.IsNullOrEmpty for both. - if (string.IsNullOrEmpty(oldValue) && string.IsNullOrEmpty(newValue)) + var timer = tooltipTimer; + if (timer == null) { + OpenOrCloseToolTip(newValue); + return; } @@ -2151,14 +2153,18 @@ private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArg /// The instance containing the event data. private void OnLoaded(object sender, RoutedEventArgs routedEventArgs) { - // TODO: Consider making the delay here configurable. - tooltipTimer = new DispatcherTimer( - TimeSpan.FromSeconds(0.5), - DispatcherPriority.Render, - OnTooltipTimerTick, - Dispatcher - ); - tooltipTimer.IsEnabled = false; + var initialShowDelay = ToolTipService.GetInitialShowDelay(this); + + if (initialShowDelay > 0) + { + tooltipTimer = new DispatcherTimer( + TimeSpan.FromMilliseconds(initialShowDelay), + DispatcherPriority.Render, + OnTooltipTimerTick, + Dispatcher + ); + tooltipTimer.IsEnabled = false; + } //Initial value for screen location browserScreenLocation = GetBrowserScreenLocation();