Exemplo n.º 1
0
        internal void AddRibbonContextualTabToPage(ContextualGroupDefinition definition, Page page)
        {
            page.PreRenderComplete -= new EventHandler(page_PreRenderComplete);
            page.PreRenderComplete += new EventHandler(page_PreRenderComplete);

            AddRibbonExtension(XmlGenerator.Current.GetContextualGroupXML(definition), page, "Ribbon.ContextualTabs", false);
            AddGroupTemplatesRibbonExtensions(definition.Tabs.SelectMany(t => t.GroupTemplates), page);

            RibbonCommandRepository.Current.AddCommands(definition);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generates Ribbon XML based on ContextualGroupDefinition object
        /// </summary>
        /// <param name="definition"></param>
        /// <returns>XML for Ribbon, it can be used in RegisterDataExtension method of the SPRibbon object</returns>
        private XElement GetContextualGroupElement(ContextualGroupDefinition definition)
        {
            var groupElement = new XElement("ContextualGroup",
                                            new XAttribute("Color", definition.Color.ToString()),
                                            new XAttribute("Command", definition.Id + ".EnableContextualGroup"),
                                            new XAttribute("Id", "Ribbon." + definition.Id),
                                            new XAttribute("Title", definition.Title),
                                            new XAttribute("Sequence", definition.Sequence),
                                            new XAttribute("ContextualGroupId", definition.Id)
                                            );

            foreach (TabDefinition tab in definition.Tabs)
            {
                groupElement.Add(GetTabElement(tab));
            }

            return(groupElement);
        }
Exemplo n.º 3
0
 internal string GetContextualGroupXML(ContextualGroupDefinition definition)
 {
     definition.Validate();
     return(new XDocument(GetContextualGroupElement(definition)).ToString());
 }