wpf-notifyicon icon indicating copy to clipboard operation
wpf-notifyicon copied to clipboard

An Empty Tool-tip Shows Next to the wpf-notifyicon TrayToolTip

Open A-Badry opened this issue 1 year ago • 6 comments

Hi, I have an empty tool-tip shows next to my TrayToolTip when it shows, seems to be the native system tool-tip (maybe!) that associate itself with every tray icon. Is this a bug? or there is something I should set to prevent it from showing? Thank you. You can see it below to the left of the word "Double".

Screenshot

A-Badry avatar Jan 15 '25 21:01 A-Badry

Seeing the same.

cooler-king avatar Jan 16 '25 22:01 cooler-king

Showing your XAML code would help a lot in reproducing this.

Deantwo avatar Mar 04 '25 15:03 Deantwo

I can't share code with you (company policy) but I can add that it's still happening and that it happens intermittently. For example, you won't see the empty Windows tray icon tooltip at all on many hovers but then it'll be there on the next one without anything in particular seeming to have changed. I can also add that the problem exists both when setting ToolTipText or using a custom TrayToolTip.

cooler-king avatar Mar 04 '25 22:03 cooler-king

I can't share code with you (company policy)

No one is expecting you to share your company code. You just have to show the problem.

Usually when you find an issue like this, you create a small sample project to reproduce the issue. Then you can show that small sample project here, so people know exactly what the issue is and how to reproduce it.

Once it can be reproduced, it can be debugged and solved. Until then, this is left here until someone has more time than you.

PS: I might be in a bad mood. Sorry.

Deantwo avatar Mar 04 '25 22:03 Deantwo

If I can create a minimal reproduction I will send it to you. In the meantime I thought the information might be useful. Thanks for taking a look at this.

cooler-king avatar Mar 04 '25 22:03 cooler-king

Hi everyone. My code is really simple: XAML: <Application.Resources> <Border x:Key="TrayToolTip" TextBlock.FontSize="13" Background="GhostWhite" CornerRadius="4" UseLayoutRounding="True"> <Border.Effect> <DropShadowEffect ShadowDepth="0" BlurRadius="5"/> </Border.Effect> <StackPanel Margin="10" TextBlock.Foreground="Black"> <TextBlock Text="Free Gamma" Margin="0 0 0 2"/> <TextBlock Text="Double click to restore"/> </StackPanel> </Border> </Application.Resources> C#: NotifyIcon.IconSource = new BitmapImage(new Uri("pack://application:,,,/Free Gamma;component/FreeGamma.ico", UriKind.Absolute)); NotifyIcon.TrayToolTip = (UIElement)Application.Current.FindResource("TrayToolTip"); NotifyIcon.Visibility = Visibility.Hidden; NotifyIcon.TrayMouseDoubleClick += delegate {this.Show(); NotifyIcon.Visibility = Visibility.Hidden;};

The entire code is here: https://github.com/A-Badry/Free-Gamma

Notes:

  • The issue is random, it happens intermittently as cooler-king said.
  • It continued to happen even when I manually set NotifyIcon.ToolTipText to null or "".
  • I decided to switch to normal text tooltip to see if there is a difference, so I set NotifyIcon.TrayToolTip to null and set some text to NotifyIcon.ToolTipText, and I didn't had the issue since then (more than a month now), So for me the issue is related to using a WPF tootip and leaving the normal text tooltip empty, i.e. when NotifyIcon.TrayToolTip = some_UIElement and NotifyIcon.ToolTipText = "" or null.
  • What about setting both of them? oddly I didn't think of testing that earlier, but when I did it now, only the UIElement tooltip shows, the normal text tooltip didn't show neither having the text nor empty! but I didn't test that for enough time.

Thank you very much.

======= Edit: The empty tooltip showed today (2 days later). This means if you use TaskbarIcon.TrayToolTip, the issue can occur no matter the value you set to TaskbarIcon.ToolTipText.

A-Badry avatar Mar 05 '25 19:03 A-Badry