The Infragistics Ribbon control is a very functional
control. It supports the same styling as the Office 2007 platform. What's nice
about this platform is that the controls within the ribbon fit to the contours of
the section it is given, which means you have to manage less about the ribbon.
In addition, it automatically includes spacing between
columns when one grouping overflows. It's nice not to have to manage those
details about the control itself. To see how well this works, start by going
to the Infragistics Toolbox, and selecting the UltraToolbarsManager component and
dragging it onto a Windows Form. It will prompt you to add a docked control to
the form, so the form can be setup correctly (since the ribbon is docked to the
top). The following toolbar appears:
Figure 1
The "Show Ribbon" option allows the developer to
show and hide the ribbon in the screen, expanding or compacting it. This is
nice if you have limited working room, you can collapse it out of the way.
Design MiniToolbar designs a toolbar that is similar to the ToolStrip approach,
and it is out of the scope of this article. We are going to focus on the
Ribbon only, and by clicking New Toolbar, the following prompt opens:
Figure 2
In the ribbon control, we have a new toolbar that appears as
below:
Figure 3
The Toolbar has several collections that are important when
setting up the Ribbons; first, there is a Ribbon property, which has a Tabs
collection. This collection hosts the series of tabs available in the ribbon
(such as ribbon1 above). There is a Toolbars collection, which lists each
toolbar (we have one toolbar with one ribbon as shown above), and the tools
associated with that toolbar. In addition, there is an overall Tools
collection, which contains all of the tools (buttons, etc.) setup in either the
mini toolbar, or the ribbons.
To setup the form, these properties can be used to setup controls
on the form. However, the designer for the Infragistics controls is very
dynamic, as we will soon see. There are two ways to add controls; go into the
Tabs collection editor in the Properties window. Select the ribbon1 tab, and
go to the Groups collection. Add a couple of groups, and view the results
below:
Figure 4
When clicking on the tool, the following form appears,
containing a variety of properties that you can assign (similar to the toolbar
form above). You can see that there is a nice list of controls that you can
embed into your ribbon control.
Figure 5
Using some of these options, I quickly setup the following
ribbon. Though it may not make the most sense from the options I used, it's
meant to illustrate some of the various options available:
Figure 6
Each item in the group is configurable. To do this,
right-click an item, this will adjust several of the needed properties. In
addition, the designer for the Toolbar manager also makes it easier with the
following control:
Figure 7
Clicking "New Group" creates new groups that can
be adjusted appropriately. And, to help rapidly setup the code for the
control, the designer has a "Generate Tool Click Code" option that
pops up an editor to perform the requested action, as shown below.
Figure 8
In addition, Infragistics supports loading and saving
configuration options, as well as a variety of other features to make this a
very capable control. The last feature that I'll mention is that the top
region portion is also customizable using the same approach as shown above.
Figure 9
This is the top bar with a button, masked edit, and textbox.