Skip to main content

DevExpress v24.1 Update — Your Feedback Matters

Our What's New in v24.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Ribbon Form

  • 4 minutes to read

A Ribbon Form (RibbonForm) embeds the Ribbon Control and supports skins.

RibbonForm - Overview

The RibbonForm class derives from the XtraForm class and shares most of its features, like glow or shadow effects. Unlike XtraForm, a ribbon form’s borders and title bar are always skinned.

#Add Ribbon Forms to the Project

The fastest way to start a project with a RibbonForm as your main form is to utilize UI-ready DevExpress templates. All templates that implement a Ribbon-based UI utilize Ribbon Forms.

OfficeInspired - Project Templates

To add new Ribbon Forms, right-click your project in Visual Studio’s Solution Explorer window and select “Add DevExpress Item | New Item…”. This will invoke the Template Gallery with new item templates. Select “Ribbon Form”, enter the form name and click “Add Item”.

XtraForm - Add New Item

#Convert Standard Forms to Ribbon Forms

To replace existing default forms with RibbonForms, invoke form smart-tags and select the “Convert to Ribbon Form” option. This action will also add RibbonControl and RibbonStatusBar controls to your form if it does not yet contain them.

ILA - Form Smart tag

To do the same in code, simply change the base class from which your form derives from System.Windows.Forms.Form to DevExpress.XtraBars.Ribbon.RibbonForm. You will also need to add the DevExpress.XtraBars library to your project.

using DevExpress.XtraBars;

namespace DXApplication1 {
    public partial class Form1 : RibbonForm {
        public Form1() {
            InitializeComponent();
        }
    }
}

#Compound Form Captions

By default, a Ribbon Form’s title is a text string assigned to the RibbonForm.Text property. The RibbonControl provides two string properties to override this default title: RibbonControl.ApplicationCaption and RibbonControl.ApplicationDocumentCaption. The first property stores the constant form caption, while the second can be modified in code to display the title of the currently selected MDI document.

RibbonForm - Compound Captions

Both title strings can be customized with the help of the RibbonAppearances.FormCaption and RibbonAppearances.FormCaptionForeColor2 properties. To utilize them, add the DefaultBarAndDockingController to your form and access the required properties through the BarAndDockingController.AppearancesRibbon property.

defaultBarAndDockingController1.Controller.AppearancesRibbon.FormCaption.ForeColor = Color.LightGray;
defaultBarAndDockingController1.Controller.AppearancesRibbon.FormCaptionForeColor2 = Color.Lime;

#Increased Border Width

Enable the WindowsFormsSettings.FormThickBorder or WindowsFormsSettings.MdiFormThickBorder property to enlarge Ribbon Form borders and broaden the resize area. Note that these settings affect all XtraForms and RibbonForms in the application.

image

Enlarged borders make it easier for users to resize forms when shadow/glow effects are off, and the default form resize area is too small.

#Embedding the Ribbon Quick Access Toolbar

If you wish to display the Quick Access Toolbar above the parent Ribbon, this toolbar will be shown within the Ribbon Form’s title bar.

RibbonForm - QAT

#Embedding the Status Bar

The Ribbon Form integrates with the RibbonStatusBar control. A status bar can also display a size grip element, which end users can drag to resize the Ribbon Form in both directions.

RibbonForm - Status Bar and Size Grip

#Interaction with the BackstageView Control

The BackstageView Control is the main application menu for any Ribbon, whose RibbonControl.RibbonStyle is not set to “Office2007”. The backstage menu has its own styles; to change them, utilize the BackstageViewControl.Style property.

In the Office 2010 style, the backstage menu keeps the form’s title bar and ribbon page headers visible.

RibbonForm - BS2010

In the Office 2013 style, the BackstageView control occupies the entire form. Depending on the BackstageViewControl.BackstageViewShowRibbonItems property value, in this style, a backstage menu can show the Ribbon Form title, form buttons and Ribbon page header items on its surface.

RibbonForm - BS2013

#Ribbon Display Options

When a Ribbon Control is in the “Office 2013” style, the Ribbon Form displays an additional button next to the standard Minimize, Maximize and Close buttons. Upon clicking, this button pops up a menu with available display modes for the Ribbon Control. Using this menu, a user can switch the Ribbon to a full-screen mode or minimize Ribbon pages, leaving only their tab headers visible.

RibbonForm - Display Mode Selector

Disable the RibbonControl.ShowDisplayOptionsMenuButton option to hide this button.

Turn on the OptionsExpandCollapseMenu.EnableExpandCollapseMenu option to enable the Ribbon Display Options popup menu and hide the button from the form’s caption.

Ribbon Display Options Menu

#Aero Support

For Windows Vista and 7, Ribbon Forms include built-in support for the Aero Glass effect. If your application runs on one of these operating systems and the Aero effect is enabled in system settings, the form title bar and borders will be semi-transparent, as shown below.

RibbonForm - Aero

To disable this effect even if the operating system has the Aero interface on, set the RibbonForm.AllowFormGlass property to DefaultBoolean.False. In this case, form borders and title bars will be painted according to the currently selected skin.