Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Collapse]Ribbon, Bars and Menu
   [Collapse]Bars
    [Expand]Tutorials
     MDI Merging
    [Expand]Bar Manager Designer
    [Expand]Runtime Customization and Layout Management
    [Expand]Appearance and Hotkeys
   [Expand]Ribbon
   [Expand]Popup Menus
    Radial Menu
   [Expand]Common Features
   [Expand]Examples
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

MDI Merging

MDI Bar Merging combines links from parent and child window toolbars in MDI applications.

By default, only main menus merge automatically. Regular and status bars must be merged manually.

Expanded Merge Main Menus

  1. Create a sample MDI application based on standard or DevExpress forms.
  2. Add BarManager components to both parent and child MDI windows. Create main menus, status and regular bars, then populate them.

  3. Run the application to see the main menus merging automatically.

  4. BarManagers merge immediately after the application starts. To change this behavior and force BarManagers to merge only when a child window activates or maximizes, utilize the BarManager.MdiMenuMergeStyle property for the parent manager. Using the same property, you can also turn bar merging off.
  5. There are now two "Help" sub-menus, one belongs to the parent main menu, the second belongs to the child main menu.

    You have an option to combine such items. To do so, you need to set the BarItem.MergeType properties of both items to BarMenuMerge.MergeItems. Captions of both items also have to be absolutely identical (including the hidden "&" character).

    Using the same property, you can exclude specific links from merging or make one link replace another in case both links have the same captions.
  6. Parent and child toolbar links are arranged in the same order these links were in their original toolbars. To re-arrange these links, utilize the BarItem.MergeOrder property.

Expanded Merge Regular and Status Bars

  1. Handle the parent BarManager's BarManager.Merge and BarManager.UnMerge events and run the application. If you have left the BarManager.MdiMenuMergeStyle property in its default Always value, regular and status toolbars of child MDI forms will now be hidden.

    This behavior is caused by the BarManager.HideBarsWhenMerging property. If you want your child toolbars to remain visible without merging, set this property for child Managers to false.
  2. In the BarManager.Merge event handler, call the Bar.Merge method for a parent toolbar to populate it with item links of a specific child toolbar. Bar Managers merge toolbars by copying item links from one existing toolbar to another, you cannot make an entire toolbar swap its owners. Moreover, each bar can merge with one child toolbar only. With that being said, for every child toolbar merged you have to create a corresponding host toolbar in a parent Bar Manager. If a parent Manager has no fitting toolbars, you can either create fake toolbars dynamically on the BarManager.Merge event...

    ...or add blank invisible toolbars at design time and make them visible when they receive item links from child toolbars.

    Tip

    In this and the following steps, bars are accessed by their internal names. To assign a meaningful name to a bar, utilize the Bar.BarName property.

  3. To allow toolbars to undo your manual merging when needed, call the Bar.UnMerge method on the BarManager.UnMerge event. The UnMerge method takes no parameters, it returns all merged item links back to their original owners. Depending on whether you have created host parent toolbars at design time or dynamically at runtime, you will need to hide these toolbars or dispose of them respectively.
  4. After both Merge and Unmerge event handlers are ready, run the application to see the result.

    Same as for main menus, you can utilize the BarItem.MergeType and BarItem.MergeOrder properties to customize and re-arrange merged items.

Expanded Application UI Manager Merging Specifics

The Application UI Manager, a component for building advanced multi-document interfaces, provides the DocumentManager.RibbonAndBarsMergeStyle property. When this property equals RibbonAndBarsMergeStyle.Default, merging is entirely managed by a parent Bar Manager and its BarManager.MdiMenuMergeStyle setting. Other property values affect the merging outcome as follows.

In Tabbed View.

DocumentManager.RibbonAndBarsMergeStyle = Always DocumentManager.RibbonAndBarsMergeStyle = WhenNotFloating
BarManager.MdiMenuMergeStyle = Always Any currently active Document merges its toolbars. Only toolbars from active tabs merge.
BarManager.MdiMenuMergeStyle = OnlyWhenChildMaximized Toolbars do not merge.
BarManager.MdiMenuMergeStyle = WhenChildActivated Any currently active Document merges its toolbars. Only toolbars from active tabs merge.
BarManager.MdiMenuMergeStyle = Never Toolbars do not merge

In Native MDI View.

DocumentManager.RibbonAndBarsMergeStyle = Always DocumentManager.RibbonAndBarsMergeStyle = WhenNotFloating
BarManager.MdiMenuMergeStyle = Always Toolbars from any active MDI window merge.
BarManager.MdiMenuMergeStyle = OnlyWhenChildMaximized Toolbars do not merge.
BarManager.MdiMenuMergeStyle = WhenChildActivated Toolbars from any active MDI window merge.
BarManager.MdiMenuMergeStyle = Never Toolbars do not merge

Expanded See Also

How would you rate this topic?​​​​​​​