WPF。如何为NotifyIcon创建绑定上下文菜单项(Windows窗体)

时间:2015-06-18 15:31:59

标签: c# wpf winforms binding notifyicon

这是我的代码。我需要制作绑定属性" Checked"在上下文菜单的一个元素中。 该应用程序是WPF,但我使用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);

0 个答案:

没有答案