Click here to Skip to main content
13,506,014 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


47 bookmarked
Posted 7 Aug 2010

Introducing Ribbon UI Control for WPF

, 27 Sep 2010
Rate this:
Please Sign up or sign in to vote.
Ribbon UI control set with the use of all items that would look nice with your application in WPF. A sample application is also provided.


After reading Pete Brown in his post on 2nd Aug announcing the new RibbonUI feature in his post, Announcing:Microsoft Ribbon for WPF, I thought why not try this cool control set myself. So on this note, I tried the control set that Microsoft just introduced and created an application. It is time to introduce with the new control, so that for you it would be easier to start working with it.

Ribbon Bar was introduced with Office 2007 has lately been very much popular for latest UI development. Microsoft has replaced the old Menu based application tool with more flexible and easy to learn Ribbon strips in many of its applications. So it is time for other developers to use it in their own applications. The Ribbon UI feature that was released recently bridges this to us.

In this article I am going to introduce you with the Ribbon Control in WPF. If you are not familiar with WPF, please read
WPF Article Series

What is Ribbon ?

Ribbon is a sort of Toolbar or rather Command Bar which arranges different Command buttons, gallaries, etc in Tabs at the top of the application Window. The controls in the Tabs can further be grouped and also introduces Contextural Tabs etc. So in short, Ribbon replaces toolbar and menu controls that are there with windows and gives a solid look on the application UI.

This is the default Ribbon Template that comes when you first create your application and also gives you a better idea on how the new RibbonWindow looks like.

Download RibbonTestApplication Source

How to start?

Now to start creating your first application, you need :

  1. Visual Studio 2010. You can install Visual Studio trial from here. Or you can try Visual Studio 2010 Express from here.
  2. After you install Visual Studio 2010, you need to install Microsoft Ribbon for WPF from here. You can also install this in Vs 2008. In that case you need to take reference to the dll explicitly.
  3. After you install, Launch Visual Studio 2010 and select WPF Ribbon Application from Visual Studio Project Templates.

    Add new RibbonApplication from VS templates
  4. After you select the project template, your default application will be created. It automatically creates you a Ribbon control UI with a few sample buttons as shown below:

    You will see the sample application from template
  5. The RibbonControlsLibrary.dll is already referenced and the Window is actually inherits from RibbonWindow which includes customized title bar and status bar.
  6. So its time to get started.

Features of Ribbon UI

Lets address each of the features of RibbonUI so that you could apply them while creating your own Ribbon Based Application.

Application Menu : Each Ribbon Application should have one Application Menu associated with it. The application menu is composed of a series of Dropdown Buttons that displays menu items.
The left side of the ApplicationMenu contains MenuItems. Each of which may contain its Submenu as well. The right hand side contains the RecentItems represented by ApplicationMenu.RecentItems.

Quick Access Toolbar : Every Ribbon control has Quick access toolbar which are small buttons that allows you to access frequently used commands. The quick access toolbar is present in the Title bar of the window.

Super ToolTip : WPF Ribbon bar introduces enhanced tooltip to describe your command the best way possible. We call it superTooltip.

KeyTips : KeyTips are unique feature associated with each ribbon to invoke menuitems using Keyboard Shortkuts. You can define KeyTip for each Tab, Buttons etc which will show up whenever the Alt with the Key combination is pressed.

Automatic Resizing RibbonItems : Each ribbon has implemented in such a way that the Ribbon will be resized when there is shortage of space automatically. Large RibbonButton will be converted to small Buttons and again converted to MenuItem when space is constrained.

Group Ribbon Tabs : A Ribbon control can have multiple RibbonTab 's. So You can group the set of Commands into individual Tabs.
Demonstrate Tabs and Groups in Ribbon
 Contextual Ribbon Tab : You can also have Contextual Ribbon Tab, a special Tab that will display dynamic content based on User interaction.

Ribbon Combobox Gallery Items : Gallery are special items that have special features, like hover zoom effect, dropdown effect, etc.

So, with never ending new features with Ribbon,  lets define each of the features by implementing the same.

Why use RibbonWindow than Window?

A RibbonWindow is a class derived from Window in WPF. The class RibbonWindow have the capability to draw Quick Access toolbar buttons and Contextual TabGroup into it. So if you want to support these features, you must use RibbonWindow rather than a normal Window. To Add a new RibbonWindow, just use Ribbon

After you select RibbonWindow, the template will produce a default Window as :

<ribbon:RibbonWindow x:Class="RibbonTestApplication.MainWindow"

We are going to use this window to implement our RibbonControl.


So lets build our application with most of the components one by one :


The Application menu contains main Menuitems at the left side, the AuxilaryPane in the right side and the FooterPane in the bottom of the MainMenu.
 RibbonApplicationMenu is a control that creates the Application Menu for the RibbonWindow. Each window can have only one Application Menu. The application menu can have RibbonApplicationMenuItem, RibbonApplicationSplitMenuItem, RibbonSeparator etc. You can nest RibbonApplicationMenuItem to have Submenu for an item.

Lets look how to build this menu  :

    <ribbon:RibbonApplicationMenu SmallImageSource="Images\MyComputer.ico">
        <ribbon:RibbonApplicationMenuItem Header="Desktop" ImageSource="Images\Desktop.ico" KeyTip="D" Click="RibbonApplicationMenuItem_Click"/>

        <ribbon:RibbonApplicationMenuItem Header="Floppy" ImageSource="Images\HardDrive.ico" KeyTip="F">
            <ribbon:RibbonApplicationMenuItem Header="Primary Floppy" ImageSource="Images\FloppyDrive3.ico" KeyTip="P" Click="RibbonApplicationMenuItem_Click" />
            <ribbon:RibbonApplicationMenuItem Header="Secondary Floppy" ImageSource="Images\FloppyDrive5.ico" KeyTip="S" Click="RibbonApplicationMenuItem_Click" />

        <ribbon:RibbonApplicationMenuItem Header="My Pictures" ImageSource="Images\MyPictures.ico" KeyTip="M" Click="RibbonApplicationMenuItem_Click"/>
        <ribbon:RibbonApplicationMenuItem Header="My Videos" ImageSource="Images\MyVideos.ico" KeyTip="V" Click="RibbonApplicationMenuItem_Click"/>
        <ribbon:RibbonSeparator />
        <ribbon:RibbonApplicationSplitMenuItem Header="Search Program" ImageSource="Images\Search.ico">
            <ribbon:RibbonApplicationMenuItem Header="BMP Images" ImageSource="Images\BMPImage.ico" Click="RibbonApplicationMenuItem_Click"/>
            <ribbon:RibbonApplicationMenuItem Header="JPEG Images" ImageSource="Images\JPEGImage.ico" Click="RibbonApplicationMenuItem_Click"/>
            <ribbon:RibbonApplicationMenuItem Header="GIF Images" ImageSource="Images\GIFImage.ico" Click="RibbonApplicationMenuItem_Click"/>
            <ribbon:RibbonApplicationMenuItem Header="PNG Images" ImageSource="Images\PNGImage.ico" Click="RibbonApplicationMenuItem_Click"/>

                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto" />
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Grid.Column="0">
                    <ribbon:RibbonButton Content="My Music" SmallImageSource="Images\MyMusic.ico" Click="RibbonButton_Click"/>
                    <ribbon:RibbonButton Content="Web Folders" SmallImageSource="Images\WebFolders.ico" Click="RibbonButton_Click"/>
                    <ribbon:RibbonButton Content="Settings" SmallImageSource="Images\Settings.ico" Click="RibbonButton_Click"/>
                <ribbon:RibbonButton SmallImageSource="Images\AudioCD.ico" Label="Exit" HorizontalAlignment="Right" Grid.Column="2" Command="ApplicationCommands.Close" />

            <TextBlock Text="This is the Auxilary Pane. You can also add RibbonGallery to AuxiliaryPane." />


In the above code I have declared a few RibbonApplicationMenuItem for Desktop, MyPicture, My Video etc. You can click on each of them to invoke the Click EventHandler. We specify the Image path directly to the ImageSource of the Menu Item.


To define Submenu, you can create as many RibbonApplicationMenuItem inside an individual MenuItem as u wish. Just in the above code, I have nested Primary Floppy and Seconday Floppy inside the Floppy MenuItem. The KeyTip defines the hot key which you can access by pressing Alt Key from the keyboard.

Normal MenuItem with submenu


The RibbonApplicationSplitMenuItem on the other hand has slight difference from the normal RibbonApplicationMenuItem. If you see the second Submenu that I have provided in the sample application, you will discover that it is actually a Menu Item which have splitted button with a separator.

Split MenuItem

In case of SplitMenuItem, you can either use the item as MenuItem or you can use it to select its SubMenuItems. 


RibbonSeparator allows you to produce a separation between two sets of items. You can use it either in MenuItems or in RibbonGroups.
AuxilaryPane is generally used to list GalleryItems of all the Recent items accessed by the application. The Right hand blank area of the RibbonMenu is called AuxillaryPane.  In the sample application I have put a TextBlock to write few lines in the AuxillaryPane.

The FooterPaneContent on the other hand allows to access the footer of the Menu. I have added few RibbonButtons on the FooterPane.


The main part of a Ribbon is RibbonTab. Each RibbonTab contains a set of RibbonGroup, each of which contains individual controls. A Ribbon can have multiple RibbonTab associated with it.

<ribbon:RibbonTab ContextualTabGroupHeader="ContextualHeader" Header="Selected">
        <ribbon:RibbonButton LargeImageSource="Images\HelpFile.ico"
                                Label="Help" />
<ribbon:RibbonTab Header="View">
<ribbon:RibbonTab Header="Insert">

<ribbon:RibbonTab Header="Format">

Thus it will define few RibbonTab namely View, Insert, Format and Selected. You must notice the first RibbonTab contains a RibbonGroup. The RibbonGroup will produce a Button Help.

You must also notice, if you specify ContextualTabGroupHeader for a RibbonTab, it will produce the Contextual Tab from the TitleBar of the RibbonWindow. The ContextualRibbonTab is generally not visible, but appears whenever some action is taken by the user to show the individual contextual Ribbon.

    <ribbon:RibbonContextualTabGroup Header="ContextualHeader"
                                    Background="Orange" />


Ribbon control has a property called ContextualTabGroups which you can use to Group each RibbonContextualTabGroup and alter its Visibility. The Ribbon ContextualTabGroup allows you to access each ContextualTabs during runtime.  In my sample application I have specified the Visibility=Visible for the ContextualHeader ContextualTab. So  it will appear whenever you start the application.


Each RibbonGroup have a GroupHeader, which is placed at the botton of the Group, the Items can be of Large Button Type or a Small Button type. The size of the Button is identified automatically based on the image we pass.

<ribbon:RibbonGroup Header="Control Panel">
    <ribbon:RibbonButton LargeImageSource="Images\ControlPanel.ico"
                            Label="Settings Folder" 
                            ToolTipTitle="Settings Folder"
                            ToolTipDescription="Helps you change settings of the folder and also allows you to change certain system settings"

    <ribbon:RibbonButton SmallImageSource="Images\ConfigurationSettings.ico"
                            ToolTipTitle="Configuration Settings"
                            ToolTipDescription="Allows you to change Configuration settings for the current selection"
    <ribbon:RibbonButton SmallImageSource="Images\NetworkConnections.ico"
                            ToolTipTitle="Network Settings"
                            ToolTipDescription="Allows you to change Network settings for the current selection"
    <ribbon:RibbonButton SmallImageSource="Images\ProgramGroup.ico"
                            ToolTipTitle="Program Settings"
                            ToolTipDescription="You can change the Program settings"

Here we mentioned LargeImageSource for the first button while others have defined SmallImageSource. You can see instead of RibbonButton content we use Label to show the label text. RibbonButton exposes the Label Text to the interface.

Super ToolTip

RibbonButton has three properties to show Super tooltip. Each super Tooltip can have Title which you can specify using ToolTipTitle. The ToolTipDescription is used for description text and ToolTipImageSource is used to show the Image on the left of the Description.

When the Settings Folder is hovered, the Super ToolTip appears just below the RibbonTab.


Just like RibbonSplitMenuItem, RibbonSplitButton has a Button and a menu associated with it. Each RibbonSplitButton is a group of normal RibbonButton and a Menu. You can individually access the Button, or you can use it to get a item from the menu.

<ribbon:RibbonSplitButton Label="WorkGroup" LargeImageSource="Images\Workgroup.ico">
    <ribbon:RibbonMenuItem Header="Folder Options" ImageSource="Images\FolderOptions.ico" />
    <ribbon:RibbonMenuItem Header="Printers and Fax" ImageSource="Images\printersFaxes.ico"/>
    <ribbon:RibbonMenuItem Header="Network Service" ImageSource="Images\NetworkService.ico"/>

The RibbonSplitButton can have RibbonMenu in its content. The menuitems will be listed when the button is clicked.

Other Ribbon UI controls

The Ribbon can have many other UI elements as well. RibbonTextBox, RibbonToggleButton, RibbonCheckBox are some of the instances. You can use each of them as you normally do.

<ribbon:RibbonCheckBox Label="Single Check" />
 <ribbon:RibbonToggleButton Label="Entire Network" SmallImageSource="Images\EntireNetwork.ico"  />
 <ribbon:RibbonTextBox Label="Run" SmallImageSource="Images\RUN.ico" />
 <ribbon:RibbonComboBox Label="Folders" SmallImageSource="Images\SharingOverlay.ico" ItemsSource="{Binding Path=FolderItems}" />
<ribbon:RibbonTwoLineText LineStackingStrategy="BlockLineHeight" Text="Two lines of Text"/>

The Label is used to display text in the Ribbon and SmallImageSource/LargeImageSource is used to display the associated image.

The RibbonTwoLineText is used to display Text in Ribbon.


RibbonGallery can be associated with a ComboBox. A RibbonGallery is a special component of a Ribbon bar, that have very rich visual interface.

<ribbon:RibbonComboBox Label="1" 
      IsEditable="True" >
    <ribbon:RibbonGallery SelectedValue="Green"
           <ribbon:RibbonGalleryItem Content="Green" Foreground="Green" />
            <ribbon:RibbonGalleryItem Content="Blue" Foreground="Blue" />
           <ribbon:RibbonGalleryItem Content="Orange" Foreground="Orange" />

The RibbonComboBox hosts a RibbonGallery with three RibbonGalleryItems.

Gallery Item
 The comboBox lists the Gallery items in it. This is the most simple use of Gallery items.


Another important feature is the QuickAccessToolBar feature with Ribbon control Each of the RibbonWindow can have a Quick Access Toolbar which lists itself in the title bar of the window. To define the QuickAccessToolBar we use QuickAccessToolBar property of Ribbon. The RibbonQuickAccessToolBar control helps to list the controls in the QuickAccess toolbar.

    <ribbon:RibbonQuickAccessToolBar HorizontalAlignment="Right">
        <ribbon:RibbonButton SmallImageSource="Images\RAMDrive.ico" KeyTip="R" />
        <ribbon:RibbonButton SmallImageSource="Images\OpenFolder.ico" KeyTip="O"/>
        <ribbon:RibbonButton SmallImageSource="Images\MyRecentDocuments.ico" KeyTip="R"/>

The QuickAccessToolbar automatically produces a Menu when the space is constrained.

Similar to normal ContextMenu, Ribbon contextMenu can also be altered to create your own custom ContextMenu. The RibbonContextMenu is used instead of normal ContextMenu to list each individual RibbonMenuItems.

        <ribbon:RibbonMenuButton SmallImageSource="Images\RecycleBinf.ico" Label="Special ContextMenu Option" />
        <ribbon:RibbonMenuButton SmallImageSource="Images\RecycleBine.ico" Label="Normal ContextMenu Option" />
        <ribbon:RibbonMenuButton SmallImageSource="Images\RemovableDrive.ico" Label="Extra ContextMenu Option" />

Minimizing a RibbonBar

A RibbonBar automatically holds few properties. One of such is minimizing the RibbonBar. When you minimize a RibbonBar, the RibbonBar will appear like a menu, which lets you use the full space of the window for other controls.
To minimize a Ribbon, just Right click on any RibbonTab and select Minimize. The window will appear just like above.

Note :

Ribbon control supports ICommand interface, so you can built applications using Command Bindings. In the sample application I didnt used Command interfaces for simplicity. You may use it just the same way as you do with WPF Buttons.

Download RibbonTestSample Source


RibbonUIControls are introduced recently to enable the WPF application to use RibbonWindow. In this article, I have demonstrated each of the features introduced with the library so that it helps any developer to grab the feature easily.

It is nice to try this cool rich controlset introduced recently. I hope you would like the article, and the article will help you in the long run.

Thanks for reading, looking for your Valuable Feedbacks.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Abhishek Sur
India India
Did you like his post?

Oh, lets go a bit further to know him better.
Visit his Website : to know more about Abhishek.

Abhishek also authored a book on .NET 4.5 Features and recommends you to read it, you will learn a lot from it.

Basically he is from India, who loves to explore the .NET world. He loves to code and in his leisure you always find him talking about technical stuffs.

Working as a VP product of APPSeCONNECT, an integration platform of future, he does all sort of innovation around the product.

Have any problem? Write to him in his Forum.

You can also mail him directly to

Want a Coder like him for your project?
Drop him a mail to

Visit His Blog

Dotnet Tricks and Tips

Dont forget to vote or share your comments about his Writing

You may also be interested in...


Comments and Discussions

QuestionNothing Works Pin
James JM5-Jun-16 0:55
memberJames JM5-Jun-16 0:55 
QuestionCannot download source code Pin
huunghia8714-Sep-14 14:14
memberhuunghia8714-Sep-14 14:14 
AnswerRe: Cannot download source code Pin
Gabee819-Oct-15 7:51
memberGabee819-Oct-15 7:51 
QuestionHow to disable this auxiliary pane area ? Pin
Alok.singh116621-Apr-13 7:45
memberAlok.singh116621-Apr-13 7:45 
QuestionHOw do i re-size the auxiliary pane area ? Pin
Alok.singh116621-Apr-13 7:44
memberAlok.singh116621-Apr-13 7:44 
GeneralMy vote of 1 Pin
vijayksingh25-Mar-13 1:39
membervijayksingh25-Mar-13 1:39 
AnswerRe: My vote of 1 Pin
Maciej Los16-Nov-13 11:09
mvpMaciej Los16-Nov-13 11:09 
QuestionImage Size? Pin
amirmn78-Sep-12 19:57
memberamirmn78-Sep-12 19:57 
Suggestion[My vote of 2] Suggestion about coding part Pin
Niyazi Yarar29-Jul-12 18:40
memberNiyazi Yarar29-Jul-12 18:40 
GeneralRe: [My vote of 2] Suggestion about coding part Pin
Abhishek Sur30-Jul-12 10:52
memberAbhishek Sur30-Jul-12 10:52 
AnswerRe: [My vote of 2] Suggestion about coding part Pin
Niyazi Yarar30-Jul-12 11:12
memberNiyazi Yarar30-Jul-12 11:12 
QuestionDisable Application Menu In Office 2010 Pin
atulrungta20-Jan-12 4:32
memberatulrungta20-Jan-12 4:32 
Your post is very useful nd excellent.
But can you plz help me in disabling application menu in office 2010.
I have embedded an excel application in my winform application. but i want to disable users to click on file menu so they cannot perform any task using file menu.
kindly mail me at
GeneralVote of 5 Pin
Jonathan C Dickinson12-Oct-10 23:03
memberJonathan C Dickinson12-Oct-10 23:03 
QuestionWhat about Silverlight? Pin
Ricardo Ildefonso5-Oct-10 3:09
memberRicardo Ildefonso5-Oct-10 3:09 
Questioncheckable items in a Gallery? Pin
Peter Freestone4-Oct-10 12:53
memberPeter Freestone4-Oct-10 12:53 
GeneralMy vote of 5 Pin
KunalChowdhury8-Aug-10 3:37
mentorKunalChowdhury8-Aug-10 3:37 
GeneralRe: My vote of 5 Pin
Abhishek Sur8-Aug-10 9:48
mvpAbhishek Sur8-Aug-10 9:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180417.1 | Last Updated 27 Sep 2010
Article Copyright 2010 by Abhishek Sur
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid