by Danielvg
6. March 2010 22:57
In an attempt to save some of my WPF and XAML knowledge before it completely faded away, I decided to make a small application build with the MVVM pattern. The result is a proof of concept application that I been thinking about making for some time. The application is pretty simple, it is possible to add tabs, groups and buttons, to what should look like a ribbon, and get a xml file that can be used to define a SharePoint 2010 Ribbon.
An example; a ribbon with two tabs, the first tab has two groups with a total of 5 buttons and the second tab has one group with one button, as the screenshot below shows:

When the “Generate xml” button is pushed, in the example above, the following xml will be saved to a file:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="RibbonTest.LeRibbon" Sequence="0">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition>
<Tab Sequence="0" Title="A New Tab">
<Scaling />
<Groups>
<Group Sequence="0">
<Controls>
<Button Sequence="0" LabelText="Hello" />
<Button Sequence="0" LabelText="Hello" />
</Controls>
</Group>
<Group Sequence="0">
<Controls>
<Button Sequence="0" LabelText="Hello" />
<Button Sequence="0" LabelText="Hello" />
<Button Sequence="0" LabelText="Hello" />
</Controls>
</Group>
</Groups>
</Tab>
</CommandUIDefinition>
<CommandUIDefinition>
<Tab Sequence="0" Title="A New Tab">
<Scaling />
<Groups>
<Group Sequence="0">
<Controls>
<Button Sequence="0" LabelText="Hello" />
</Controls>
</Group>
</Groups>
</Tab>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers />
</CommandUIExtension>
</CustomAction>
</Elements>
The generated xml is fare from complete but it does give a decent template to work with.
The application should only be seen as a test for now, but I hope to develop it further and maybe start a Codeplex project at some point. I have been looking for a “pet” project and maybe this will be it, if for nothing else then at least to keep WPF in the fingertips.
EDIT: ups, source code can be found here:
SharePointRibbonBuilder.zip (96,12 kb)