Best SharePoint feature yet

Feb 8, 2012 at 9:10 PM
Edited Feb 8, 2012 at 9:47 PM

Alas, I have implemented your ribbons often. But one problem I have is how to have large and small icons occuring in the same group. Right now i have to separate the groups into SimpleTemplate or ThreeRowTemplate, is there anyway to have both occurring in the same group.

Also the Standard Library buttons how do I use those, the class is not showing in the intellisense and saying it doesn't exist. I am using the last build you have added.

Regards,

 

Wayne

Coordinator
Feb 9, 2012 at 7:03 AM
Edited Feb 9, 2012 at 7:04 AM

Wayne, thanks a lot for your feedback!

You will need to implement a custom Group Template to achieve the described appearance. Unfortunately this is not very easy to explain, but I'm planning to write an article on this. (this issue is actually addressed in WorkItem 15, please vote for it if you're interested in it's realization)

And yes, I will check avaliability of the Standard Buttons functionality and write you back as soon as possible.

Coordinator
Feb 16, 2012 at 3:21 PM
Edited Feb 16, 2012 at 3:25 PM

Sorry for the delay, it was really a hectic week :(

Unfortunately, I cannot guarantee any fixed period for the article, so here is the very rough example of how a custom Group Template could be implemented:

var myGroupTemplate = new GroupTemplateDefinition()
{
	Id = "MyCustomGroupTemplate",
	SizeId = "Large",
	SectionIds = new string[] { "c1", "c2", "c3", "c4" },
	GetXMLFunc = (GroupTemplateDefinition definition) =>
	{
	return
@"<GroupTemplate Id=""" + definition.Id + @""">
	<Layout Title=""Large"">
		<Section Type=""TwoRow"">
			<Row>
				<ControlRef TemplateAlias=""c1"" DisplayMode=""Medium"" />
			</Row>
			<Row>
				<ControlRef TemplateAlias=""c2"" DisplayMode=""Medium"" />
			</Row>
		</Section>
		<Section Type=""TwoRow"">
			<Row>
				<ControlRef TemplateAlias=""c3"" DisplayMode=""Medium"" />
			</Row>
			<Row>
				<ControlRef TemplateAlias=""c4"" DisplayMode=""Medium"" />
			</Row>
		</Section>
		<Section Type=""OneRow"">
			<Row>
				<ControlRef TemplateAlias=""c5"" DisplayMode=""Large"" />
			</Row>
		</Section>
	</Layout>
</GroupTemplate>";
	}
}

The example creates a group template with 5 static placeholders for 5 ribbon controls. You can determine, where the control goes, by specifying the TemplateAlias attribute value in the control definition. Of course, also you should properly initialize GroupDefinition.Template and TabDefinition.GroupTemplates properties.

Other examples of possible Group Templates could be found in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL\XML\CMDUI.XML file, you can adopt them safely, just don't forget to change the Ids.

I still hope I'd find a gap in my schedule to write the article with the detailed explanations on the topic. Anyway, if you have any particular questions related to this example, please, don't hesitate to ask them here.

Coordinator
Mar 3, 2012 at 7:03 PM

Addition about the Standard Library buttons:

Probably you didn't find them because the ControlLibrary class is placed inside FluentRibbon.Libraries namespace. Please, make sure that you specified this namespace in usings.

Anyway, I uploaded the most fresh version of dll to the 1.4 release page.

Jul 20, 2012 at 5:59 AM

hi , omlin , 

use  Template = myGroupTemplate,

I get page script error:A template with name:MyCustomGroupTemplate could not be loaded.

 

thanks.

Coordinator
Jul 22, 2012 at 11:22 AM

Hello, jinho!

Please, ensure that you have properly initialized GroupTemplates property of your tab definition, inside which the control group is placed. This property must include all the templates which are used in tab's groups. By default, it only includes two OOTB Fluent Ribbon templates.

I realize, that such requirement causes dublication of data and is not very convenient, so this will probably change in the next release of the Fluent Ribbon API.

Thank you for you feedback and please, do not hesitate to ask any additional questions!

Nov 18, 2013 at 8:50 PM
I'm having the same issue even though I have set both GroupDefinition.Template and TabDefinition.GroupTemplates. Am I doing something wrong here?
 public static GroupTemplateDefinition TwoMediumTwoLarge = new GroupTemplateDefinition()
        {
            Id = "TwoMediumTwoLarge",
            SizeId = "Large",
            SectionIds = new string[] { "c1", "c2", "c3", "c4" },
            GetXMLFunc = (GroupTemplateDefinition definition) =>
            {
                return
                @"<GroupTemplate Id=""" + definition.Id + @""">
                    <Layout
                        Title=""Large"">
                        <Section Type=""TwoRow"">
                        <Row>
                            <ControlRef DisplayMode=""Medium"" TemplateAlias=""c1"" />
                        </Row>
                        <Row>
                            <ControlRef DisplayMode=""Medium"" TemplateAlias=""c2"" />
                        </Row>
                        </Section>
                        <Section Type=""OneRow"">
                        <Row>
                            <ControlRef DisplayMode=""Large"" TemplateAlias=""c3"" />
                            <ControlRef DisplayMode=""Large"" TemplateAlias=""c4"" />
                        </Row>
                        </Section>
                    </Layout>
                </GroupTemplate>";
            }
        };


        public static GroupTemplateDefinition[] AllTemplates
        {
            get
            {
                return new GroupTemplateDefinition[] { TwoMediumTwoLarge };
            }
        }
 var group = new GroupDefinition()
            {
                Id = "ExportGroup",
                Title = "Export",
                Template = AllTemplates[0],        
                
                Controls = new ControlDefinition[]
                {
                    button1,
                    button2,
                    label,
                    dropDown
                }
            };

            var tab = new TabDefinition()
            {
                Id = "MyTabId",
                Title = "Export Report",
                Groups = new GroupDefinition[] { group },
                GroupTemplates = AllTemplates
              };
Nov 20, 2013 at 12:23 AM
I found out that the only way to add a new template is to call RibbonCustomAction.AddTemplate.

It shouldn't really need this because it could find out what templates are used in the TabDefinition objects in the RibbonCustomAction. But failing that it would be nice to have it generate a validation error to tell you that you're using a template that isn't included.