4

I have a tray app backed by a NotifyIcon. It sometimes fires toast notifications via notifyIcon.ShowBallonTip(). It is running on Windows 10 1607.

I'm subscribed to the following two events:

notifyIcon.MouseUp += notifyIcon_MouseUp;
notifyIcon.BalloonTipClicked += notifyIcon_BalloonTipClicked;

At first glance everything works great:

  • When I click on the tray icon, I get the MouseUp event and the correct things happen
  • When I click on the toast, I get the BalloonTipClicked event and the correct things happen

The bug in the app right now is that if the user clicks on the tray icon while the toast is showing, it acts as if the user clicked on the toast instead. In other words, clicking on the tray icon while the balloon/toast is showing will fire BallonTipClicked even though the balloon/toast was never actually clicked.

When I am in BalloonTipClicked the "sender" is just the NotifyIcon. I don't see any way of distinguishing "balloon tip clicked" vs "tray icon clicked". I mean, the event itself is called BallonTipClicked so I have no idea why it fires when I click the app icon.

According to MSDN this should not be happening:

BalloonTipClicked: Occurs when the balloon tip is clicked.

MouseUp: Occurs when the user releases the mouse button while the pointer is over the icon in the notification area of the taskbar.

Are the docs wrong? Any ideas for getting the behavior I intend?

Community
  • 1
  • 1
Rafael
  • 71
  • 1
  • 3
  • 1
    Yes, Win10 created a fair amount of havoc by unifying the UI for tray balloon tips with the toast notifications produced by WinRT apps. Known problem, no known workaround. It does not appear to massively confuse users, this may change again in a future Win10 build. – Hans Passant Feb 11 '17 at 10:06
  • Hm. I think that the unification of UI is fine. The confusing part is that apps are getting BalloonTipClicked events in cases where the balloon tip wasn't clicked. – Rafael Feb 11 '17 at 18:30
  • There is also another problem there. The BalloonTipClosed will not fire if BalloonTipClicked fired already. This is again in Win10, .NET Core 3. – MoonStom Jul 26 '19 at 14:07

0 Answers0