VSTO & .NET & Excel

June 4, 2009

Implement the Ribbon UI in Windows Forms

Filed under: .NET & Excel, .NET SQL Tester, VSTO & Excel — Dennis M Wallentin @ 6:45 pm

Some of us Excel developers like the Ribbon UI while others find it more difficult to work with it. No matter what we developers think about it exist a growing number of clients requiring that the Ribbon UI to be implemented in .NET based Excel solutions.

Microsoft offers no controls that can be used to implement any Ribbon UI solution so we are forced to decide which third-party controls package to be used.  Of cause, most large vendors, such as Component One et al, offer components that can be used but they can be rather expensive.  DotNetBar from DevComponents is an inexpensive controls package including controls for the Ribbon UI.  I have been using the package for a while in clients solutions. DotNetBar includes 47 controls whereof some controls allow us to create a Ribbon UI in Windows Forms. All controls that are shipped with DotNetBar are highly customized. The controls are also frequently updated and new versions of DotNetBar are released on a regular basis.

With the package a collection of relevant case studies are shipped, both in VB and in C#. A knowledgebase is available to the DotNetBar customers and I find it easy to use it and it also provides relevant links based on the search criterias. The knowledgebase can also be accessed via the help file. The help file describes, in a strictly technical way, the DotNetBat assembly and its namespaces.

The following screen shot shows DotNetBar Samples Explorer: 

DotNetBar4

Because I find the controls to be good, especially the Ribbon UI controls, I have decided to use them for the upcoming .NET version of my commercial tool for Excel, the SQL Tester. The following screen shots are from the alpha version of SQL Tester.NET and all controls in use are part of DotNetBar package. 

The following screen shot views the main Windows Forms for SQL Tester.NET in the VS IDE. In addition to use a Ribbon UI it also use a tabcontrol with two tabs. These tabs will be synchronized with the tabs in the Ribbon UI and therefore is hidden when the tool is being executed.

DotNetBar1

Next screen shot shows the code in use to synchronize the tabs in the tab control with the tabs in the Ribbon control:

CodeDotNetBar

Having access to a tab’s click event is something we miss when building native Ribbon UI solutions in Excel. With DotNetBar we have it available without the need to create any workaround. Initially it may take some time to get used to the controls and what they offer. In my experience I would like to say that the more time we put into learning the controls the more we can leverage them in our Windows Forms solutions.

The following two screen shots show when SQL Tester.NET is being executed and we switch between the tabs in the Ribbon UI solution.

DotNetBar2

DotNetBar3

Kind regards,
Dennis

Blog at WordPress.com.