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?