WPF. How to create context menu item for NotifyIcon (Windows Forms)

Here is my code. I need to make the "Checked" binding properties in one context menu item. WPF app, but I'm using Windows Forms NotifyIcon.

// Create NotifyIcon
var notifyIcon = new System.Windows.Forms.NotifyIcon();
notifyIcon.Icon = new System.Drawing.Icon(Properties.Resources.IconLogo, new System.Drawing.Size(16, 16));

// Add context menu
notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu();
var menuItem = new System.Windows.Forms.MenuItem(Properties.Resources.MenuItem, NotifyIconContextMenu_Click);
menuItem.Checked = Properties.Settings.Default.MenuItemChecked;// TODO Need to add binding here
notifyIcon.ContextMenu.MenuItems.Add(menuItem);

      

+3


source to share





All Articles