这是我的代码。我需要制作绑定属性" 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);