Click here to Skip to main content
15,886,806 members
Articles / Desktop Programming / Windows Forms

Windows Ribbon for WinForms, Part 1 – Introduction

Rate me:
Please Sign up or sign in to vote.
3.91/5 (18 votes)
1 Mar 2010Ms-PL3 min read 66.8K   52   7
In this article, I'll present the background information needed on the latest Windows 7 Ribbon Framework.

Introduction

This series of CodeProject articles is based on a series of posts I've first published on my blog.

So here is the plan: I'll write a series of posts regarding using the Windows Ribbon with .NET WinForms.

The goal

Having .NET wrappers for using Windows Ribbon in WinForms applications, and a set of examples of how to use each and every ribbon feature.

Development methodology

I'll develop a library that will hold all the relevant classes, interfaces, and native functions. The library will use the Windows API Code Pack, since they have already implemented good wrappers for some of the shell interfaces we will use.

Update (18.11.2009): The library is not dependent on Windows API Code Pack anymore, though it is still a recommended download. Also, I'll try to keep my conventions similar to the ones used in the Code Pack.

Along with the library I will develop a sample WinForms application (or more) that will show how to correctly use the library.

The most updated version of the code will be available on CodePlex.

Background

So, before we start to code, let's have some background on the subject.

Definition (from MSDN): The Windows Ribbon (Ribbon) framework is a rich command presentation system that provides a modern alternative to the layered menus, toolbars, and task panes of traditional Windows applications".

In Office 2007, Microsoft introduced a new way to organize UI in an application. The problem with the old UI was that it wasn't flexible enough to represent the majority of Office features. (People actually kept asking for features that already existed but were hidden deep in the menus...)

word ribbon

[Microsoft Word 2007 Ribbon]

After the Office 2007 Ribbon turned out to be a success, many UI companies provided their own implementation for a ribbon control to be used in your application. When Microsoft realized they were onto something good, they decided to supply the Ribbon feature to the general public. They have released 3 (!) Ribbons:

  • MFC version, available in Visual Studio 2008 SP1, to be used by native MFC developers.
  • WPF version, available in the WPF toolkit for .NET 3.5 SP1, to be used by managed WPF developers.
  • Windows Ribbon, available in Windows 7 as a COM object [and in a future Vista update], to be used by native Win32 developers.

So, what about managed WinForms users? They should use the third, COM based version. So, the purpose of these posts is to give you a working example of using the Windows Ribbon within a WinForms application.

Why use Windows Ribbon?

Note that the question I want to answer is not "Why use a ribbon control?" but "Why use this ribbon control?" Why not use other ribbon controls? There are dozens of third party controls; some of them are free.

The main reason why we should use the Windows Ribbon Framework: it's developed by Microsoft. This means:

  • Since it's the original one, it contains all the features, as opposed to other free/commercial ribbon controls which always have those "not implemented" sections.
  • It has complete support and integration with Windows 7 UI and accessibility features. Just think about touch screen support or high DPI screens compatibility.

That's it for now. Hopefully, you gained some motivation for the project.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Software Developer (Senior) Verint
Israel Israel
Arik Poznanski is a senior software developer at Verint. He completed two B.Sc. degrees in Mathematics & Computer Science, summa cum laude, from the Technion in Israel.

Arik has extensive knowledge and experience in many Microsoft technologies, including .NET with C#, WPF, Silverlight, WinForms, Interop, COM/ATL programming, C++ Win32 programming and reverse engineering (assembly, IL).

Comments and Discussions

 
GeneralCurrent development Pin
harbor16-Oct-20 23:09
harbor16-Oct-20 23:09 
QuestionIs MDI supported? Pin
balagp15-Apr-12 2:20
balagp15-Apr-12 2:20 
GeneralMy vote of 2 Pin
#realJSOP7-Mar-10 10:12
mve#realJSOP7-Mar-10 10:12 
GeneralRe: My vote of 2 Pin
cplas8-Mar-10 19:15
cplas8-Mar-10 19:15 
GeneralRe: My vote of 2 Pin
Arik Poznanski8-Mar-10 22:14
Arik Poznanski8-Mar-10 22:14 
These articles originated from a post series I wrote. I've found it usful so wanted to bring it to CodeProject audience.
Unfortunately I've added my blog feed to CodeProject too late, so couldn't publish them that way.
I agree that some of them are short as articles but rewriting them (21 posts!) would require way too much work.
It took several days just to prepare them for publish on CodeProject (remove code coloring, using different html tags, etc.)

The code is NOT a wrapper around API Pack. It is a wrapper around the native Win32 Ribbon Framework API.
When the project started it had the API Pack as a dependency, but this has changed since then.
Arik Poznanski

QuestionWindows XP? Pin
thompsons2-Mar-10 5:39
thompsons2-Mar-10 5:39 
AnswerRe: Windows XP? Pin
Arik Poznanski2-Mar-10 5:45
Arik Poznanski2-Mar-10 5:45 

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.