示例#1
0
 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();
 }
示例#2
0
        public ToolBarDropDownButton(Codon codon, object caller, IList subMenu)
        {
            ToolTipService.SetShowOnDisabled(this, true);

            this.codon  = codon;
            this.caller = caller;

            this.Content = ToolBarService.CreateToolBarItemContent(codon);
            if (codon.Properties.Contains("name"))
            {
                this.Name = codon.Properties["name"];
            }
            this.DropDownMenu = MenuService.CreateContextMenu(subMenu);
            UpdateText();
        }
示例#3
0
        public ToolBarSplitButton(Codon codon, object caller, IList submenu, IReadOnlyCollection <ICondition> conditions)
        {
            ToolTipService.SetShowOnDisabled(this, true);

            this.codon      = codon;
            this.caller     = caller;
            this.conditions = conditions;

            this.Content = ToolBarService.CreateToolBarItemContent(codon);
            if (codon.Properties.Contains("name"))
            {
                this.Name = codon.Properties["name"];
            }

            this.Command          = CommandWrapper.CreateLazyCommand(codon, conditions);
            this.CommandParameter = caller;
            this.DropDownMenu     = MenuService.CreateContextMenu(submenu);

            UpdateText();
        }
        public ToolBarSplitButton(Codon codon, object caller, IList submenu)
        {
            ToolTipService.SetShowOnDisabled(this, true);

            this.codon  = codon;
            this.caller = caller;

            this.Content = ToolBarService.CreateToolBarItemContent(codon);
            if (codon.Properties.Contains("name"))
            {
                this.Name = codon.Properties["name"];
            }

            menuCommand       = (ICommand)codon.AddIn.CreateObject(codon.Properties["class"]);
            menuCommand.Owner = this;

            this.Command      = new CommandWrapper(codon, caller, menuCommand);
            this.DropDownMenu = MenuService.CreateContextMenu(submenu);

            UpdateText();
        }
        public ToolBarSplitButton(Codon codon, object caller, IList submenu)
        {
            ToolTipService.SetShowOnDisabled(this, true);

            this.codon  = codon;
            this.caller = caller;

            if (codon.Properties.Contains("icon"))
            {
                var image = PresentationResourceService.GetImage(StringParser.Parse(codon.Properties["icon"]));
                image.Height = 16;
                image.SetResourceReference(StyleProperty, ToolBarService.ImageStyleKey);
                this.Content = new PixelSnapper(image);
            }

            menuCommand       = (ICommand)codon.AddIn.CreateObject(codon.Properties["class"]);
            menuCommand.Owner = this;

            this.Command      = new CommandWrapper(codon, caller, menuCommand);
            this.DropDownMenu = MenuService.CreateContextMenu(submenu);

            UpdateText();
        }