public ToolBarDropDownButton(Codon codon, object caller, IList subMenu, IEnumerable <ICondition> conditions) :
            base()
        {
            ToolTipService.SetShowOnDisabled(this, true);

            this.codon       = codon;
            this.caller      = caller;
            this.conditions  = conditions;
            this.Orientation = Orientation.Vertical;
            //MenuItem rootMenu = new MenuItem();

            if (codon.Properties.Contains("template") || codon.Properties.Contains("style") || codon.Properties.Contains("packIconKey"))
            {
                ToolBarService.CreateTemplatedToolBarItem(this, codon);
            }
            else
            {
                this.Content = ToolBarService.CreateToolBarItemContent(codon);
            }

            this.ItemsSource = MenuService.ExpandMenuBuilders(subMenu, false);
//			ContextMenu contextMenu = MenuService.CreateContextMenu(subMenu);
//			foreach (MenuItem item in contextMenu.Items) {
//				rootMenu.Items.Add(item);
//			}

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

            //this.Items.Add(rootMenu);

            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;

            if (codon.Properties.Contains("template") || codon.Properties.Contains("style") || codon.Properties.Contains("packIconKey"))
            {
                ToolBarService.CreateTemplatedToolBarItem(this, codon);
            }
            else
            {
                this.Icon = ToolBarService.CreateToolBarItemContent(codon);
            }

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

            this.Command          = CommandWrapper.CreateLazyCommand(codon, conditions);
            this.CommandParameter = caller;
            this.ItemsSource      = MenuService.ExpandMenuBuilders(submenu, false);

            UpdateText();
        }