Hi,
I’m going to write the posts about FluentSPRibbon in plain English because I think my new framework is important across the German boundaries :)
Every SharePoint developer who is building Ribbon based solutions know about the problem. You have to write tons of XML to form the entire ribbon on an ApplicationPage for example. So somewhere in your code you have to put all this xml. And this approach – in my opinion – has some disadvantages.
The XML is
- weekly typed
- not checked at compile time
- not automatically tested
- not as readable as Plain C# Code
So somewhere in your MyApplicationPage.cs you’ll find something like this
<Tabs Id="FluentRibbon.TabsContainer">
<Tab Id="FluentRibbon.FluentRibbonTab1"
Title="Hello World Tab!"
Sequence="1001"
Description="see http://www.dotnet-rocks.de">
<Groups Id="FluentRibbon.FluentRibbonTab1.GroupsContainer">
<Group Id="FluentRibbon.FluentRibbonTab1.ActionsGroup"
Title="$Resources: MyResourceFile, Key"
Sequence="10"
Description="These are my actions">
<Controls Id="FluentRibbon.FluentRibbonTab1.ActionsGroup.ControlsContainer">
<Button Id="FluentRibbon.FluentRibbonTab1.ActionsGroup.MyButton1"
LabelText="Click me!" />
</Controls>
</Group>
<Group Id="FluentRibbon.FluentRibbonTab1.WorkflowActions"
Title="My Workflow Actions"
Sequence="20"
Description="Master your Workflows by using Ribbon Elements">
<Controls Id="FluentRibbon.FluentRibbonTab1.WorkflowActions.ControlsContainer">
<Button Id="FluentRibbon.FluentRibbonTab1.WorkflowActions.Button2"
TemplateAlias="1" />
</Controls>
</Group>
<Group Id="FluentRibbon.FluentRibbonTab1.ViewSettingsGroup"
Title="Customize your view"
Sequence="30"
Description="Customize the current view for your needs">
<Controls Id="FluentRibbon.FluentRibbonTab1.ViewSettingsGroup.ControlsContainer" />
</Group>
</Groups>
</Tab>
<Tab Id="FluentRibbon.FluentRibbonTab2"
Title="FluentRibbon rocks"
Sequence="1002"
Description=".NET Rocks Fluent SPRibbon API">
<Groups Id="FluentRibbon.FluentRibbonTab2.GroupsContainer" />
</Tab>
</Tabs>
For better readability I’ve removed lot of the commonly used properties on most elements. I like Ribbon UI but the customization API is really bad.
But wait. I’ve a solution for that issue. I’m currently writing on FluentSPRibbon!
FluentSPRibbon
FluentSPRibbon is a dsl (Domain specific language) for building SharePoint Ribbon customizations in a better, a more comfortable way. It offers tons of great features for you as a SharePoint Developer. You’ve got no of the disadvantages that the default xml way offers to you.
So FluentSPRibbon offers
- strongly Typed API
- automatic ID creation
- compile TimeCheck
- a fully tested Framework
- a fluent C# API
- automatic Resource building (for MUI)
- automatic URI generation for Images (you can define a global imagefolder and the Framework will build the URLs automatically
- XSD validation
- many more of course
How does it looks like?
Somewhere within your ApplicationPage:

As you can see you have a strongly typed API for build a SharePoint Ribbon. This is just the simplest way to build a ribbon. It’s still very loud, but the API has capabilities to reduce the amount of code you have to write. For example there is an overload Set method which accepts an IDictionary<PropertyEnum,Value> to reduce the lines of code. As shown in figure 2.

There is also a static class called RibbonSettings where you can define a ResourceFileIdentifier. By setting the ResourceFileIdentifier the FluentSPRibbon will automatically convert all properties of any RibbonElement that is visible in the SharePoint UI to an ResourceLink. There is also an ImageFolder property on the RibbonSettings class, by setting this property the framework will automatically build up a valid path to any ImageProperty on any RibbonElement.
In figure 3 these properties are used.

For example: The API will generate the following output
<Tabs Id="FluentRibbon.TabsContainer">
<Tab Id="FluentRibbon.FluentRibbonTab1"
Title="$Resources:MyResourceFile, Tab1Title"
Sequence="1001"
Description="$Resources:MyResourceFile, Tab1Description">
<Groups Id="FluentRibbon.FluentRibbonTab1.GroupsContainer">
<Group Id="FluentRibbon.FluentRibbonTab1.ActionsGroup"
Title="$Resources:MyResourceFile, Group1Title"
Sequence="10"
Description="$Resources:MyResourceFile, Group1Description">
<Controls Id="FluentRibbon.FluentRibbonTab1.ActionsGroup.ControlsContainer">
<Button Id="FluentRibbon.FluentRibbonTab1.ActionsGroup.MyButton1"
Image32by32="/_layouts/FluentSPRibbon/Images/CoolIcon.png"
LabelText="$Resources:MyResourceFile, MyButton1LabelText" />
</Controls>
</Group>
<Group Id="FluentRibbon.FluentRibbonTab1.WorkflowActions"
Title="$Resources:MyResourceFile, Group2Title"
Sequence="20"
Description="$Resources:MyResourceFile, Group2Description">
<Controls Id="FluentRibbon.FluentRibbonTab1.WorkflowActions.ControlsContainer">
<Button Id="FluentRibbon.FluentRibbonTab1.WorkflowActions.Button2"
LabelText="$Resources:MyResourceFile, Button2LabelText" />
</Controls>
</Group>
<Group Id="FluentRibbon.FluentRibbonTab1.ViewSettingsGroup"
Title="$Resources:MyResourceFile, Group3Title"
Sequence="30"
Description="$Resources:MyResourceFile, Group3Description">
<Controls Id="FluentRibbon.FluentRibbonTab1.ViewSettingsGroup.ControlsContainer" />
</Group>
</Groups>
</Tab>
<Tab Id="FluentRibbon.FluentRibbonTab2"
Title="$Resources:MyResourceFile, Tab2Title"
Sequence="1002"
Description="$Resources:MyResourceFile, Tab2Description">
<Groups Id="FluentRibbon.FluentRibbonTab2.GroupsContainer">
<Group Id="FluentRibbon.FluentRibbonTab2.Group4711"
Title="$Resources:MyResourceFile, Group4711Title">
<Controls Id="FluentRibbon.FluentRibbonTab2.Group4711.ControlsContainer">
<TextBox Id="FluentRibbon.FluentRibbonTab2.Group4711.MyTextBox"
ShowAsLabel="TRUE"
Width="100px" />
</Controls>
</Group>
</Groups>
</Tab>
</Tabs>
What you’ll get right now oob is
- Strings are translated to ResourceLinks
- Image Links are redirected to the correct folder
- Ids are build automatically
- Non visible items such as the Controls container are build automatically
There are many more features that FluentSPRibbon offers. Within the next weeks I’ll write about them and show more examples on that topic.
Declarative Ribbon Customizations
On the other side we have declarative Ribbon customizations which are commonly realized by providing an Elements.xml file. For these kinds of customization I first thought about T4 Templates. But the big disadvantage is, that T4 offers no IntelliSense. :/
Till now I don’t know what could be the best solution for that kind of ribbon customizations.. but I’m sure that you can give me some advices. Can’t you?
Beta Testers
I’m lookin forward to hit milestone later this month. So I’m lookin for beta testers. Are you doing Ribbon Customizations in SharePoint? Feel free to contact me by email thorsten.hans@gmail.com and I’ll send you the beta build as early as possible.
Codeplex
The FluentSPRibbon will be available on CodePlex for free!