Skip to content

Preview the Ribbon

harborsiem edited this page Sep 1, 2020 · 4 revisions

Before we get into the details, let’s build and preview the project. Choose "Project | Build (Ctrl F9)" or click the Build button on the toolbar. The RibbonTools will now perform the following steps:

  1. Save the ribbon project to an XML file (RibbonMarkup.xml in this example).
  2. Call the Microsoft Ribbon Compiler (UICC.exe) to compile this XML file into a binary version (RibbonMarkup.bml), a header file (RibbonMarkup.h) and a resource script file (RibbonMarkup.rc).
  3. Call the Microsoft Resource Compiler (RC.exe) to compile the RibbonMarkup.rc file and all related images files into a resource file (RibbonMarkup.res).
  4. Call the Microsoft Linker (Link.exe) to generate a resource DLL (RibbonMarkup.ribbon).
  5. Convert the xml file and the generated header file (RibbonMarkup.h) to a C# or Visual Basic (VB) source file (RibbonItems.Designer.cs or RibbonItems.Designer.vb). One of these files will be used later in your project to access the ribbon commands and controls in the code behind. The output of these processes will be shown at the bottom of the screen in the Output window. If all steps succeed, you can now press the Preview button on the toolbar. The RibbonTools will open the generated resource DLL and use it to create a preview form:

Not bad for about a minute work. With the preview form, you can test the ribbon and the application menu. Of course, nothing will happen when you press any ribbon buttons, but it will give you good idea of what the ribbon will look like in your application. The preview form also contains 4 tabs with which you can test the following functionality:

  • Application Modes: you can specify multiple application modes for your ribbon (we will come back to this in more detail in an other Wiki page). For example, WordPad has two application modes: the standard mode (mode 0) and a Print Preview mode (mode 1). The Print Preview mode is activated in WordPad when you select Print Preview from the application menu. You can activate Print Preview mode in the preview form by checking Application Mode 1 and unchecking Application Mode 0. Try it and see what happens.
  • Contextual Tabs: you can specify contextual tabs for your ribbon (again, more details in an other Wiki page). Contextual tabs are a set of ribbon tabs that only appear in specific contexts. For example, in Word 2007/2010, a set of "Table Tools" contextual tabs will appear when you select a table in a Word document. WordPad does not have contextual tabs, so you cannot test them here now. However, if you design a ribbon with contextual tabs, you would be able to activate and deactivate those tabs here.
  • Context Popups: you can declare several context popups in your ribbon document (more details in an other Wiki page). A context popup can contain a mini toolbar, a context menu or both. WordPad has 3 different context popups, depending on what is selected in the document. You can test these popups here. Just select the popup you want to see and it will pop up. Note that WordPad does not use any mini toolbars, just context menus.
  • Colorize: The Ribbon Framework allows you to colorize the ribbon any way you want. Not just using the Blue, Black and Silver themes that you may know from MS Office. This tab allows you to experiment with different color schemes or create your own. Now, we will show you how this ribbon has been designed. Close the preview window and go to the next page Specifying Ribbon Commands.

Table of contents

Clone this wiki locally