Example #1
0
        private void ProcessTogglePopupNode(RibbonPanel panel, XmlNode node)
        {
            string commandName = node.Attributes["internalName"].Value;

            ButtonDefinition controlDef =
                _Application.CommandManager.ControlDefinitions[commandName] as ButtonDefinition;

            bool?  useLargeIcon  = XmlUtilities.GetAttributeValueAsNullable <bool>(node, "useLargeIcon");
            bool?  showText      = XmlUtilities.GetAttributeValueAsNullable <bool>(node, "showText");
            string targetControl = XmlUtilities.GetAttributeValue <string>(node, "targetControl");
            bool?  insertBefore  = XmlUtilities.GetAttributeValueAsNullable <bool>(node, "insertBefore");
            bool?  isInSlideout  = XmlUtilities.GetAttributeValueAsNullable <bool>(node, "isInSlideout");

            bool slideout = isInSlideout.HasValue ? isInSlideout.Value : false;

            CommandControls controls = (slideout ? panel.SlideoutControls : panel.CommandControls);

            ObjectCollection buttons = GetButtons(node);

            if (buttons.Count > 0)
            {
                controls.AddTogglePopup(
                    controlDef,
                    buttons,
                    useLargeIcon.HasValue ? useLargeIcon.Value : false,
                    showText.HasValue ? showText.Value : true,
                    string.IsNullOrEmpty(targetControl) ? string.Empty : targetControl,
                    insertBefore.HasValue ? insertBefore.Value : false);
            }
        }