SandRibbon User Guide
Making your Application Unique
If you are reading this documentation as a tutorial you probably have a generic Office form showing with an essentially generic ribbon with a few buttons on.
The RibbonForm class uses both the Text and ApplicationText properties to show text in the titlebar of your form. ApplicationText is typically the name of your application, and Text shows the relevant form or document the user is working on. SandRibbon combines these with different colors in the titlebar of your form.
The ApplicationImage property of the form is used to place an image in the main application button shown in the top-left corner. This image should be a maximum of 32x32 pixels and will have glow effects applied to it when shown in the button. Ideally you should use a high quality PNG format image with full use made of its alpha channel to give a really polished icon for your application.
One of the design goals of the ribbon is that it would not change dynamically as commands become available and unavailable. In the previous paradigm of menus and toolbars, entire toolbars and menus concerned with one set of operations (e.g. working on a picture) could be enabled and disabled at once. Now, although certain commands will still be available at certain times, the better grouping of ribbon can help prevent the situation of entire toolbars becoming useless unless a certain context prevails.
As we have seen, the top-level items within a ribbon are the ribbon tabs. Tabs like Home, Insert and Review are logical containers for all the commands associated with that mode of operation. For a mode of operation that is not always accessible - such as editing a picture - the new user interface offers contextual tabs.
A contextual tab is a tab just like any other, only it is only available at certain times. A ribbon will have several different contexts of which is aware, and these are defined in its EditingContexts collection. Opening this collection in the PropertyGrid will allow you to add a few. For an example, let's add an EditingContext with the text "Picture Tools" and the reference "PICTURE". The text is important because this is what is shown to the user as an indication of the group.
Now add a new tab to your ribbon and set its EditingContextReference to "PICTURE". You should immediately see your tab jump to the end, take on a coloured appearance and the Picture Tools text will be visible in the titlebar. You can assign as many tabs to an editing context as you like. At design time all your tabs will be visible at once for ease of use, but at runtime only one editing context (or none) can be active at any time.
At runtime there will be a specific situation in your application where you want your contextual tabs to appear. To activate an editing context, call the SetEditingContext method passing the reference of the editing context you wish to activate. All contextual tabs belonging to that context will appear. Call the same method passing an empty string or a null reference to deactivate any editing context.
You can see a simple example of this in the demonstration application, where one tab is only available when text is selected in the editor.
Super ToolTips and Help
ToolTips gained a facelift with Office 2007 and are now referred to as Super ToolTips to avoid confusion with the older type. Whereas a traditional tooltip has only text, a super tooltip can also have a description, imagery and contextual help associated with it.
All SandRibbon items can have a tooltip associated with them. To open the super tooltip editor, find the ToolTip property in the PropertyGrid. The editor allows you to set the name, description and whether the help link is displayed visually. Once you have used the editor to assign a tooltip, the ToolTip property can simply be expended in the PropertyGrid to access every feature.
When you opt to show the help link, the user can choose to press F1 while the tooltip is displayed to be taken straight to a help page describing the feature they are interested in. To make this work, you must handle the ToolTipHelpRequested event of your ribbon, in which you are passed the tooltip and indirectly the widget that the user is requesting help for.
You may also have noticed a help button is always present on the ribbon, at the opposite end from the tabs. When this is clicked the ribbon's standard HelpRequested event (common to all windows forms controls) is fired.