Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
WPF - Allow ToolTip timer configuration
- Can set initial show delay in xaml via existing ToolTipService e.g. ToolTipService.InitialShowDelay="100"
- If InitialShowDelay = 0 then no timer is used and ToolTip is immediately shown
- Previous delay was 500ms, new delay is the .Net default (typically 1000ms)

Related to issue #4048
  • Loading branch information
amaitland committed Aug 2, 2025
commit e34ce4692f9b4501e0798dc7018707609562186a
32 changes: 19 additions & 13 deletions CefSharp.Wpf/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1680,16 +1680,18 @@ private static void OnTooltipTextChanged(DependencyObject d, DependencyPropertyC
/// <param name="newValue">new value</param>
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;
}

Expand Down Expand Up @@ -2151,14 +2153,18 @@ private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArg
/// <param name="routedEventArgs">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
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();
Expand Down