wpf-notifyicon
wpf-notifyicon copied to clipboard
tray icon tooltips broken in windows 11
just displays tooltip
Hey @Samuel12321, do you have more information or is that all? What do you mean with "just displays tooltip"? In what scenario is the tray icon running, did you try the samples?
Best wishes, Robin
Hi @Lakritzator ,
Thanks for the quick response.
I'm one of the devs for ModernFlyouts, we have been using Hardcodet WPF NotifyIcon to display a tray icon. When the user hovers over it it is supposed to display a tooltip saying "ModernFlyouts" as seen in the image below.
This works well on all versions of Windows 10, however if the app is installed on Windows 11, it just displays "tooltip", as seen in the image below.
We have multiple reports confirming this occurs on all versions of Windows 11.
The source code is below.
using Hardcodet.Wpf.TaskbarNotification;
using ModernFlyouts.Helpers;
using ModernFlyouts.Utilities;
using ModernWpf;
using ModernWpf.Controls;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
namespace ModernFlyouts.UI
{
internal class TrayIconManager
{
#region Properties
public static TaskbarIcon TaskbarIcon { get; private set; }
public static ContextMenu TaskbarIconContextMenu { get; private set; }
public static ToolTip TaskbarIconToolTip { get; private set; }
#endregion
public static void SetupTrayIcon()
{
var settingsItem = new MenuItem()
{
Header = Properties.Strings.SettingsItem,
ToolTip = Properties.Strings.SettingsItemDescription,
Icon = new FontIcon() { Glyph = CommonGlyphs.Settings },
Command = CommonCommands.OpenSettingsWindowCommand
};
var exitItem = new MenuItem()
{
Header = Properties.Strings.ExitItem,
ToolTip = Properties.Strings.ExitItemDescription,
Icon = new FontIcon() { Glyph = CommonGlyphs.PowerButton },
Command = CommonCommands.ExitAppCommand
};
TaskbarIconContextMenu = new ContextMenu()
{
Items = { settingsItem, exitItem }
};
TaskbarIconToolTip = new ToolTip() { Content = Program.AppName };
TaskbarIcon = new TaskbarIcon()
{
TrayToolTip = TaskbarIconToolTip,
ContextMenu = TaskbarIconContextMenu,
DoubleClickCommand = CommonCommands.OpenSettingsWindowCommand
};
}
public static void UpdateTrayIconVisibility(bool isVisible)
{
TaskbarIcon.Visibility = isVisible ? Visibility.Visible : Visibility.Collapsed;
}
public static void UpdateTrayIconInternal(ElementTheme currentTheme, bool useColoredTrayIcon)
{
ThemeManager.SetRequestedTheme(TaskbarIconContextMenu, currentTheme);
ThemeManager.SetRequestedTheme(TaskbarIconToolTip, currentTheme);
Uri iconUri;
if (useColoredTrayIcon)
{
iconUri = PackUriHelper.GetAbsoluteUri(@"Assets\Logo.ico");
}
else
{
iconUri = PackUriHelper.GetAbsoluteUri(currentTheme == ElementTheme.Light ? @"Assets\Logo_Tray_Black.ico" : @"Assets\Logo_Tray_White.ico");
}
TaskbarIcon.IconSource = BitmapFrame.Create(iconUri);
}
}
}
Thanks, Sam
Hi Sam,
That explanation makes a bit more sense, as that what I understood before. I though you meant that the tray icon only shows tooltips and nothing else... It didn't get to me that you ment it doesn't show the correct text 😆
I will look into it, fortunately I do have some Windows 11 to play around with for my Greenshot development.
Btw. nice project.
Best wishes, Robin
I can confirm thes issue here too on a fresh Windows 11 install with my app TotalMix Volume Control.
Instead of something like:
Thanks so much in advance Fotis
Wondering if this could be the source of the problem, just saw this https://aka.ms/AAd21h2
NIN_POPUPOPEN is never sent when NOTIFYICON_VERSION_4 is specified and NIF_SHOWTIP is not Normally, when apps used notification icons version 4 with Shell_NotifyIcon and did not specify NIF_SHOWTIP, they would receive NIN_POPUPOPEN to be able to show their own tooltip. In Windows 11, these apps never receive NIN_POPUPOPEN and the Windows-default tooltip will always show, which is undesirable for some apps and completely nullifies the point of NIF_SHOWTIP.
@Samuel12321 I was expecting something like that, but didn't find it yet. Yes, that is exactly describing the issue!
Thanks for covering that up.
Please all upvote this: https://aka.ms/AAd21h2
@Lakritzator Any ideas on a workaround for this? i doubt MS will fix this quickly.
I don't see an easy way to workaround this, when the right event is missing on a level which is out of our control, it's usually hard to find some way to mitigate this. Mostly this results in a weird & ugly workaround. I myself would rather see if Microsoft can fix this, before someone spends hours of work on it.
We might be able find a Microsoft application which has the same issue, this might speed up fixing it. I tried to have a look already, for me it would have been the best if PowerToys had an issue, but unfortunately it only shows a simple tooltip in Windows 10...
I'm the one that filled the Feedback Hub entry linked above - I don't think any fix should be expected soon. We all know that Feedback Hub is like speaking to a wall.
In my case it wasn't too bad because I use the APIs raw from C++ so was able to easily find the issue (and I've always gave an appropriate fallback text, so it only downgrades from a newer tooltip to the old tooltip style in the end). It might be possible to fill an issue on the Windows App SDK repo, as they also own these OS APIs. I'd happily upvote and comment on such an issue.
It might be interesting to check the newer insider builds, since if it was fixed it probably wouldn't qualify for a cumulative update.
FYI, if someone just sets ToolTipText, would that work as a fallback then on Windows 11? I don't have a non-Windows 11 machine, so I want to make sure setting this doesn't prevent the nice/fancy tool tip from showing up on hover on Windows 10 or previous
FYI, if someone just sets ToolTipText, would that work as a fallback then on Windows 11?
Yes
There is another bug on Windows 11. By some reason long tooltip texts now showing multiline. Here the sample
On any other Windows version this tooltip is showing as single line.
The usage is quite simple.
<tb:TaskbarIcon x:Name="trayIcon" Visibility="Visible"
IconSource="{Binding Path=IconSource}"
ToolTipText="some long long long text"/>