Quickstart Tutorial: Windows Ribbon for WinForms
17. November 2010 28 Comments
Here I will show you how you can start using the Windows Ribbon from CodePlex.
Prepare your developer machine
Installation of Windows 7 SDK is required to create and modify the ribbon on a developer machine.
1. Download latest version of RibbonLib from CodePlex
You can find the library here: http://windowsribbon.codeplex.com/
2. Build the RibbonGenerator setup and install it.
Start the Visual Studio 2010 Solution of RibbonGenerator, set the build configuration to Release and build it twice!
After the second build it will compile without errors! This is an official Visual Studio 2010 bug and we have to live with it.
.\RibbonLib_v2.6\RibbonGenerator\RibbonGenerator.sln
Now you can install the new setup file that you will find here…
.\RibbonLib_v2.6\RibbonGenerator\RibbonGenerator.Setup\Release\RibbonGenerator.Setup.msi
3. Compile a Ribbon.dll
To get a compiled version of Ribbon.dll start the sample solution and build it using Visual Studio
.\RibbonLib_v2.6\Ribbon-cs.sln
4. Create a new Windows Forms application containing the Ribbon Control.
Add the Ribbon to your Toolbox doing a right-click on Toolbox / Choose Items
.\RibbonLib_v2.6\Ribbon\bin\Release\Ribbon.dll
Drag/Drop the Ribbon to your form
For your body you can add a Panel control and set the DockStyle property to Fill
Add a new Xml file to your Project and rename to Ribbon.xml
Add the following content to the file.
<?xml version='1.0' encoding='utf-8'?> <Application xmlns='http://schemas.microsoft.com/windows/2009/Ribbon'> <Application.Commands> </Application.Commands> <Application.Views> <Ribbon> </Ribbon> </Application.Views> </Application>
Set the CustomTool of the Ribbon.xml in the File Properties to RibbonGenerator to generate a .ribbon file.

Now you need to specify the .ribbon file in the Ribbon control properties on your form. The name must be the full name including the namespace.

That’s all. So have a lot of fun playing with the samples included in the download package too.


Pingback: Arik Poznanski's Blog
hi guys…nice article and control I might add…I just have one question: an application build with this control is able to run on WinXp machines or just Vista and 7?
regards,
Denis R.
Thanks, only Vista or higher…
http://www.codeproject.com/KB/toolbars/RibbonLocalization.aspx
Regards, Bernhard
Just wondering if you have to build the Ribbon control with VS10 or if you could use VS08?
The answer to “Why VS10″ is not so easy. First I don’t want to use old technology in my spare time. Second I have to read a registry value to discover the Windows SDK 7 installation path. With .NET 4.0 it’s easy also on 64bit machines. Look into the DetectAppropariateWindows7SdkPath method of RibbonGenerator.
What am I doing wrong? VS never finds the ribbon resource in the assembly. The name of my project is, let’s say “ExampleProj” and the XML file is named “Ribbon.xml”, so the ResourceName property of the ribbon control needs to be set to “ExampleProj.Ribbon.ribbon” or what? I don’t get it, I’m too stupid probably^^
VB needs the name without namespace, C# needs it with namespace. You can look into the Ribbon samples. Check that .ribbon file does exists. The .xml file is the ribbon XAML file, the .ribbon file is the compiled file generated by the RibbonGenerator custom tool.
Thanks for the fast reply. Looks like the .ribbon file isn’t generated. I’m sorry, previously I thought I still had the Windows 7 SDK installed, but I had a look in my software list after I posted my comment and saw that I must’ve uninstalled it some day. I try again with the SDK installed… then the file should be generated too, I think.
Ok, I just tried it with installed Win7 SDK. Still doesn’t create the ribbon-file. Also not for sample projects if I remove the ribbon file from the project to force its recreation from the xml one.
Sorry to spam up the comments section, delete my old comments if you want to. I fixed it. The ribbon generator tool wanted to start UICC.exe and RC.exe from a non existant “v7.1″ SDK folder! The Windows 7 SDK just installed a “v7.0″ folder on my pc (and UICC.exe is only installed if you check Win32 components in the SDK setup). I simply created the path to the “imaginary” v7.1 folder and copied the needed exes there and now it works fine.
Hi Pac-Man, it’s not necessary to copy the files. Please take a look into this post http://bernhardelbl.wordpress.com/2010/12/10/ribbongenerator-details-windows-ribbon-for-winforms/. Look into template.bat section… You can change the path to the SDK there. Another options is to delete the template.bat file. It will be recreated by the RibbonGenerator during the next run and the path should be correct corrected.
Thanks, Bernhard
Hi there!
I have 1 small question. Does You planned build for Express Versions???
Please ask this question in codeplex discussions. As I know: No further release is planned. Thanks, Bernhard
Compile not work! It prompt Authorization Data from CodePlex! May be I must use another solution file???
Hi Andrew, could you please wrote this question to arik on the codeplex site? He’s creating the releases. Thanks, Bernhard
Hello Everyone,
I was following this instructions and I have complied and installed the RibbonGeneretor tool,when I specify the name of the Custom Tool property for the XML file, it says that it cannot find the tool, I have tried this several times with no success. What could I be doing wrong?
regards,
Gonzalo
You can look here for more details…
http://bernhardelbl.wordpress.com/2010/12/10/ribbongenerator-details-windows-ribbon-for-winforms/
http://bernhardelbl.wordpress.com/2010/12/10/ribbongenerator-for-visual-studio-2010-express-editions-windows-ribbon-for-winforms/
When I am tryint o compile RibbonGeneratoe.Setup in X64 mode it is giving the following error
Error 1 File ‘rgc.exe’ of project output ‘Primary output from RibbonGenerator.Console (Active)’ targeting ‘AMD64′ is not compatible with the project’s target platform ‘x86′ F:\RibbonLib_v2.6\RibbonGenerator\RibbonGenerator.Setup\RibbonGenerator.Setup.vdproj RibbonGenerator.Setup
Please try using manual installation and registration of the custom tool…
http://bernhardelbl.wordpress.com/2010/12/10/ribbongenerator-for-visual-studio-2010-express-editions-windows-ribbon-for-winforms/
Hi, you don’ need the setup. Please use manual registration of the tool…
Best regards, Bernhard
Hi,
I think the manual registration of the tool is tallking about Express edition of Visual Studio. But I am using Ultimate. How can i get my problem solved?
Thanks,
Swetha
Hi.
How can I create normal Tabs, contextual Tabs, Commands, etc, programmatically?
I am working with C# but if anyone has a C++ library to make that, it’s ok.
Thanks in advance
You can find every information about features here Ribbon Framework on MSDN.
It is not possible to add commands and controls programmatically.
I get pleasure from, result in I discovered just what I used to be looking for. You’ve ended my four day long hunt! God Bless you man. Have a nice day. Bye
Wow, worked great!
Just missing a Ribbon Designer…
Hi. I just can’t get this to work with C# VS2010 Ultimate. It doesn’t generate the .ribbon file. Watching the log I notice that there was a problem with uicc.exe file. My guess is that Visual Studio is working with the old Windows SDK 7.0A, and not with the 7.1 that I just installed. How can I change the default to 7.1?? I’ve read several posts that shows how to do it in the C++ environment, but not C#. Thanks!
Please ask questions at codeplex. This one could be useful for you.
problem solved