public void Bind(ActionId actionId, object control) { ToolStripMenuItem nativeControl = (ToolStripMenuItem)control; nativeControl.Click += (sender, e) => { ActionManager.Execute(actionId); }; ActionManager.Updating += (s, e) => { IAction action = ActionManager.GetAction(actionId); nativeControl.Enabled = ActionManager.CanExecute(actionId); nativeControl.Checked = action.IsChecked; }; }
public void Bind(ActionId actionId, object control) { RibbonToggleButton nativeControl = (RibbonToggleButton)control; nativeControl.Click += (sender, e) => { ActionManager.Execute(actionId); }; ActionManager.Updating += (s, e) => { IAction action = ActionManager.GetAction(actionId); nativeControl.Enabled = ActionManager.CanExecute(actionId); nativeControl.Checked = nativeControl.Enabled ? action.IsChecked : false; }; }