public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values.Length == 2 && values[0] is string) { return(MenuService.CreateContextMenu(values[1], (string)values[0])); } throw new NotSupportedException(); }
public ToolBarDropDownButton(Codon codon, object caller, IList subMenu, IEnumerable <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"]; } DropDownMenu = MenuService.CreateContextMenu(subMenu); UpdateText(); }
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(); }