@@ -36,8 +36,6 @@ public class NotifyIcon : FrameworkElement, IDisposable
3636
3737 private const int WmTrayMouseMessage = InteropValues . WM_USER + 1024 ;
3838
39- private const int NIN_BALLOONUSERCLICK = InteropValues . WM_USER + 1025 ;
40-
4139 private string _windowClassName ;
4240
4341 private int _wmTaskbarCreated ;
@@ -152,11 +150,12 @@ public void ShowBalloonTip(string title, string content, NotifyIconInfoType info
152150
153151 var data = new InteropValues . NOTIFYICONDATA
154152 {
155- uFlags = InteropValues . NIF_INFO ,
153+ uFlags = InteropValues . NIF_INFO | InteropValues . NIF_MESSAGE ,
156154 hWnd = _messageWindowHandle ,
157155 uID = _id ,
158156 szInfoTitle = title ?? string . Empty ,
159- szInfo = content ?? string . Empty
157+ szInfo = content ?? string . Empty ,
158+ uCallbackMessage = WmTrayMouseMessage
160159 } ;
161160
162161 data . dwInfoFlags = infoType switch
@@ -167,6 +166,7 @@ public void ShowBalloonTip(string title, string content, NotifyIconInfoType info
167166 NotifyIconInfoType . None => InteropValues . NIIF_NONE ,
168167 _ => data . dwInfoFlags
169168 } ;
169+ data . dwInfoFlags |= InteropValues . NIIF_USER ;
170170
171171 InteropMethods . Shell_NotifyIcon ( InteropValues . NIM_MODIFY , data ) ;
172172 }
@@ -577,7 +577,7 @@ private IntPtr Callback(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam)
577577 _dispatcherTimerPos . Start ( ) ;
578578 }
579579 break ;
580- case NIN_BALLOONUSERCLICK :
580+ case InteropValues . NIN_BALLOONUSERCLICK :
581581 RaiseEvent ( new RoutedEventArgs ( BalloonTipClickedEvent ) ) ;
582582 break ;
583583 }
@@ -677,12 +677,13 @@ public event RoutedEventHandler MouseDoubleClick
677677 }
678678
679679 public static readonly RoutedEvent BalloonTipClickedEvent =
680- EventManager . RegisterRoutedEvent ( "BalloonTipClicked" , RoutingStrategy . Bubble , typeof ( RoutedEventHandler ) , typeof ( NotifyIcon ) ) ;
680+ EventManager . RegisterRoutedEvent ( "BalloonTipClicked" , RoutingStrategy . Bubble ,
681+ typeof ( RoutedEventHandler ) , typeof ( NotifyIcon ) ) ;
681682
682683 public event RoutedEventHandler BalloonTipClicked
683684 {
684- add { AddHandler ( BalloonTipClickedEvent , value ) ; }
685- remove { RemoveHandler ( BalloonTipClickedEvent , value ) ; }
685+ add => AddHandler ( BalloonTipClickedEvent , value ) ;
686+ remove => RemoveHandler ( BalloonTipClickedEvent , value ) ;
686687 }
687688
688689 private void UpdateDataContext ( FrameworkElement target , object oldValue , object newValue )
0 commit comments