How do I put a ribbon UI element in my application?

1k Views Asked by At

I'm making a winform application and think it'd benefit greatly from the Ribbon UI element. Is it possible to put a ribbon on my own application? If so, how?

I'm hoping to not rely on 3rd-party tools like Delphi because then my application will quickly look outdated in future (or maybe even current) versions of Windows. I know this because I was looking at Creating Ribbon Styled Applications and noticed that it still looks like Office 2007, even though it's being compared against WordPad in Windows 7 which uses the Office 2010 visual style, presumably on the same machine. Even now, MS Windows 8 applications use the Office 2013 styles in Explorer, WordPad, Paint, etc, and I can't see any evidence of Delphi yet supporting that visual style, or that it would adapt its style to older platforms like Vista when necessary. Sorry if this is too nitpicky, but I prefer to give my users the experience they're used to, not my own or a future one.

2

There are 2 best solutions below

4
On

I am not sure how you define "third party tool", but this code project uses a library on codeplex, which supports office 10 and office 13 style quite well.

Here are some screen shots for you to have a taste (copy from the codeplex official site):

2007

2007

2010

2010

2013

2013

0
On

If you intend to provide your users the "most native look'n'feel", you should defintely stick to the Windows Ribbon Framework. This is due to the fact that Microsoft uses this API as well for their "default" Windows Ribbon applications (MS Word, MS Paint). The advantages of this "native" implementation are (whereby this list does not claim to be exhaustive):

  • Look'n'feel orientates on the operating system. This means that your Ribbon application will look exactly the same like MS Paint and MS Wordpad on Windows 7 and 8 for example. This way the Ribbon of your application will also profit directly from improvements/patches that Microsoft provides to the Windows Ribbon Framework in future Windows updates and - of course - Windows versions).

  • No additional software required (except for Windows Vista / Server 2008, which requires the Platform Update to support the Windows Ribbon Framework).

  • COM API, the Ribbon GUI can therefore be integrated to an application of any programming language on Windows that supports COM programming (.NET, C++, Delphi, etc.).

There are several other Ribbon implementations that are provided by Microsoft (so 1st party when referring to your description), but all of them were imlemented for a specific software (Office Ribbons) or platform (WPF Ribbons) or are just outdated (MFC Ribbons). Office Ribbons are not an option for you, as these are limitted to Microsoft Office applications of course. MFC Ribbons are COM based as well, so could theoretically use them. But as said, they are pretty outdated so your application would look like an Office 2007 descendant. WPF is definitely an option, as:

  • The components are quite powerful and the WPF components are actively updated/maintained.

  • From a developers view they are even more easy to integrate into an application as there is a lot of documentation and the components are well supported by the common IDEs such as Visual Studio.

  • With the .NET framework installed, the Ribbons can even be used on "outdated" operating systems such as Windows XP. If you still need to support Windows XP / 2003, this is something you should bear in mind.

But as said, these are not the same components that Microsoft uses for its "default" Ribbon applications, so they always look a bit different as when compared to the Windows Ribbon Framwork.

So should you decide to stick with the Windows Ribbon Framework, you can now decide if you go "hardcore" and implement the required interfaces on your own, or you can use an existing wrapper such as the "Windows Ribbon for WinForms" or the "Windows Ribbon Framework for Delphi". And please do call Delphi a "3rd party tool". I guess that was because you saw the Ribbon components that are provided by Embarcadero (the Delphi publisher). It is correct, that these are heavily outdated, look like shit and are no more actively maintained (and buggy, and ...). So do not use them. Instead, use the Windows Ribbon Framework directly. The wrapper that I have mentioned above does this, it just drastically simplifies the development process as it implements all the required interfaces, comes with a designer and some sample applications.

If you would like to use a different programming language, this is no problem as well. The reason why I have mentioned Delphi first is just because you wrote about in your original post and the wrapper is quite nice. As said, you can use any other programming that supports COM API programming as well.

I hope that made things a bit more clear. [And kudos to those that have come until here! ;)]

PS: I didn't mention the actual 3rd party implementations such as those of DevExpress or TMS as you wanted to stick to Microsoft implementations anyway.