Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
   Reporting
  [Expand]Data Grid
  [Collapse]Ribbon, Bars and Menu
   [Expand]Common Features
   [Expand]Bars
   [Collapse]Ribbon
    [Expand]Overview
    [Expand]Ribbon Structure
    [Expand]Populating Ribbon
    [Expand]Ribbon Menu
    [Collapse]Features
      Ribbon Styles
      Key Tips
      Minimizing Ribbon
      MDI Ribbon Merging
     Runtime Customization
    [Expand]Examples
   [Expand]Menus
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

MDI Ribbon Merging

Ribbon merging allows you to combine elements of two different ribbon controls or ribbon status bars. This makes sense in MDI-like applications, where both main and child windows have their own ribbon controls and ribbon status bars. Although WPF lacks native support for MDI creation, you can overcome this with the help of the DevExpress DockLayoutManager component. This component provides the DocumentGroup and DocumentPanel containers that help you create native and tabbed MDI interfaces. The following animation illustrates how ribbon merging operates.

The merging process affects the following elements: RibbonPageCategory items, RibbonPages, RibbonPageGroups and BarItems within page groups, quick access toolbars and ribbon status bar controls. These elements are being added from a child RibbonControl (RibbonStatusBarControl) to the parent RibbonControl (RibbonStatusBarControl).

Expanded Merging Mechanism

By default, the merging mechanism is triggered:

  • when a DocumentPanel is maximized in a regular MDI mode.
  • when a tab (DocumentPanel) is activated in a tabbed MDI mode.

This default behavior can be changed via the DockLayoutManager.MDIMergeStyle property that affects all child panels within a DockLayoutManager. Depending on this property value, you can either completely restrict ribbon merging, allow merging for activated tabs and maximized MDI panels only, or specify all currently activated tabs and maximized MDI panels should be merged at the same time. To specify merging behavior for individual panels, use the DocumentPanel.MDIMergeStyle attached property instead. This property has a higher priority than the DockLayoutManager.MDIMergeStyle property.

It is also possible to prevent the RibbonControl/RibbonStatusBar from being merged by setting the RibbonControl.MDIMergeStyle/RibbonStatusBarControl.MDIMergeStyle property to MDIMergeStyle.Never.

Every element that is being merged has the MergeType property, which regulates precisely how parent and child ribbon elements merge. For instance, using the MergeType property, you can specify that parent and child ribbon elements with the same caption should be combined into a single element. You can also specify that child ribbon elements should simply be added to the parent ribbon or hidden after merging. See the RibbonMergeType topic for information on available merging options. To change merge types for ribbon elements, use the RibbonPageCategoryBase.MergeType, RibbonPage.MergeType, RibbonPageGroup.MergeType and BarItemLinkBase.MergeType properties.

By default, merged elements are arranged in the following order: first are the parent object elements and then child object elements. You can re-arrange elements during a merge using the MergeOrder property (see the RibbonPageCategoryBase.MergeOrder, RibbonPage.MergeOrder, RibbonPageGroup.MergeOrder and BarItemLinkBase.MergeOrder topics to learn more). The first element has a MergeOrder of 0. An element with the greatest MergeOrder value is the last. The default MergeOrder value for all elements is 0.

Consider the following Ribbon Controls:

Merging these Ribbon Controls will result in the page arrangement shown below.

After elements are merged by the MergeType and MergeOrder properties, the merging process repeats the described actions for merging sub-items. This means page categories are merged and arranged first. Then come ribbon pages, ribbon page groups and last - group items (commands). All these sub-elements have their own independent MergeType and MergeOrder properties, just like their holders.

Expanded Unmerging Mechanism

The merging operation is not irreversible. Unmerging is performed via the RibbonControl.UnMerge and RibbonStatusBarControl.UnMerge methods. If you have merged multiple Ribbon objects, you can either define which child Ribbon object should be umerged from the parent object or completely restore the parent control's layout. In the latter case, use the required Unmerge method with no parameters.

The most common way to perform an unmerging operation is to handle the DockLayoutManager.UnMerge event, which is the reverse of the DockLayoutManager.Merge event. So, in order to unmerge parent and child ribbon objects, use the same code as in the 'Merging Mechanism' section and simply replace Merge methods with the corresponding Unmerge methods.

Expanded Example

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T304338.

Expanded See Also

Is this topic helpful?​​​​​​​