private void Notify_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Clicks == 0 && e.Button == System.Windows.Forms.MouseButtons.Right) { menu.IsOpen = true; HwndSource hwnd = PresentationSource.FromVisual(menu) as HwndSource; WinUser.SetForegroundWindow(hwnd.Handle); hwnd.AddHook(WindowFilterMessage); } }