public ToolBarSplitButton(Codon codon, object caller, IList submenu, IReadOnlyCollection <ICondition> conditions) { ToolTipService.SetShowOnDisabled(this, true); this.codon = codon; this.caller = caller; this.conditions = conditions; Content = ToolBarService.CreateToolBarItemContent(codon); if (codon.Properties.Contains("name")) { Name = codon.Properties["name"]; } Command = CommandWrapper.CreateLazyCommand(codon, conditions); CommandParameter = caller; DropDownMenu = MenuService.CreateContextMenu(submenu); UpdateText(); }
public MenuCheckBox(UIElement inputBindingOwner, Codon codon, object caller, IReadOnlyCollection <ICondition> conditions) : base(codon, caller, conditions) { Command = CommandWrapper.CreateCommand(codon, conditions); CommandParameter = caller; cmd = CommandWrapper.Unwrap(Command) as ICheckableMenuCommand; if (cmd != null) { isCheckedChangedHandler = cmd_IsCheckedChanged; cmd.IsCheckedChanged += isCheckedChangedHandler; IsChecked = cmd.IsChecked(caller); } if (!string.IsNullOrEmpty(codon.Properties["shortcut"])) { KeyGesture kg = MenuService.ParseShortcut(codon.Properties["shortcut"]); MenuCommand.AddGestureToInputBindingOwner(inputBindingOwner, kg, Command, null); InputGestureText = MenuService.GetDisplayStringForShortcut(kg); } }