'ShowBalloonTip Not Working
On Windows 10, the ShowBalloonTip
method of NotifyIcon
NEVER shows the balloon tip. This would appear to have something to do with Windows itself.
If I go to Settings > System > Notifications & actions
> and find my running app (vshost32.exe
in debug mode) and click on it, then turn on Show notifications in the action center
, I can clearly see the balloon tip messages being added to the notifications, but never a balloon tip.
I assume this is a problem with Windows 10.
My NotifyIcon
is VISIBLE
my_icon.ShowBalloonTip("Title", "Message", BalloonIcon.Info);
Solution 1:[1]
On my computer with Windows 10 version 1803, go to Settings > System > Notifications & actions, and turn on "Get notifications from apps and other senders". The ballontips from my WPF app will show up.
Solution 2:[2]
Found the problem - was simple: Quiet Hours was turned on in the notification center and this was preventing the balloon tips.
Solution 3:[3]
Turn off Focus Assist. If you are using second screen, turn off "When I'm duplicating my display" option. My settings is like that:
Solution 4:[4]
Neither of these solved my issue :(
But by accident I fixed it! My problem was I had my project configured for 32-bit on a 64-bit platform and for whatever reason they only show up when when I run the project for Any CPU (64-bit in this case)!!
Hopefully that helps some of you, it was a real mystery for me...
(I also posted this answer here because these are duplicate questions)
Solution 5:[5]
Change the Solution Configuration "Debug mode to Release mode" with X64 or X32 Solution platform. It will start work.
public static NotifyIcon trayIcon;
trayIcon = new NotifyIcon();
trayIcon.Icon = new Icon("Images/Test.ico");
trayIcon.Visible = true; trayIcon.Text=Path.GetFileNameWithoutExtension(AppDomain.CurrentDomain.FriendlyName);
ContextMenu contextMenu1 = new ContextMenu();
contextMenu1.MenuItems.Add("Menu2", Menu2_Event);
contextMenu1.MenuItems.Add("Menu3", Menu3_event);
contextMenu1.MenuItems.Add("Exit", Close_Click);
trayIcon.ContextMenu = contextMenu1;
trayIcon.BalloonTipText = "Hi Test";
trayIcon.ShowBalloonTip(1000);
Solution 6:[6]
Just for reference, as @rmirabelle wrote in the question "My NotifyIcon is VISIBLE". This is actually important.
If the notification icon is not visible in the systray, the BalloonTips
won't show up either.
Possible sources for invisibility are:
- Visible property = false
- No icon is set for the
NotifyIcon
object
Solution 7:[7]
I've fixed the problem by adding icon property. If this property isn't set, the baloontip won`t be shown. Here's example of my code:
var notify = new NotifyIcon();
notify.Visible = true;
notify.Icon = new System.Drawing.Icon(@"D:\Users\User\Desktop\some.ico");
int code = new Random().Next(1000, 9999);
notify.ShowBalloonTip(500, "code", $"{code}", ToolTipIcon.Info);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Shangwu |
Solution 2 | rmirabelle |
Solution 3 | sosa |
Solution 4 | uno_1_herman |
Solution 5 | |
Solution 6 | Jens |
Solution 7 |