private void Image_MouseUp(object sender, MouseButtonEventArgs e) { var trayIcon = (sender as Decorator).DataContext as NotifyIcon; if (trayIcon != null) { if (MenuBar != null) { // set current menu bar to return placement for ABM_GETTASKBARPOS message NotificationArea.Instance.SetMenuBarSizeData(MenuBar.GetMenuBarSizeData()); } trayIcon.IconMouseClick(e.ChangedButton, getMousePos(), System.Windows.Forms.SystemInformation.DoubleClickTime); } }