Skip to main content

RibbonControl.Merge Event

Allows you to perform additional customizations after another Ribbon Control has been merged into the current RibbonControl.

Namespace: DevExpress.XtraBars.Ribbon

Assembly: DevExpress.XtraBars.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DXCategory("Merge")]
public event RibbonMergeEventHandler Merge

Event Data

The Merge event's data class is RibbonMergeEventArgs. The following properties provide information specific to this event:

Property Description
MergedChild A Ribbon control of the child MDI form.
MergeOwner A Ribbon control of the parent MDI form.

Remarks

In MDI applications, the merge and unmerge mechanisms are invoked according to the RibbonControl.MdiMergeStyle property of the Ribbon Control displayed within the main MDI form. The Merge event fires by the merge mechanism, after the child Ribbon Control has been merged into the main RibbonControl.

RibbonStatusBar objects within the main and child MDI forms are not merged automatically. To merge them, handle the Merge event and call the RibbonStatusBar.MergeStatusBar methods. To unmerge them (restore the original layout), handle the RibbonControl.UnMerge event and call the RibbonStatusBar.UnMergeStatusBar method.

See Ribbon Merging to learn more.

Example

The following example shows how to merge RibbonStatusBar objects in an MDI application, when the Ribbon merging mechanism is invoked. It’s assumed that both the parent and child MDI forms contain RibbonStatusBar objects. To merge them, the RibbonStatusBar.MergeStatusBar method is called in a RibbonControl.Merge event handler. To unmerge the status bars, the RibbonStatusBar.UnMerge method is called in a RibbonControl.UnMerge event handler.

using DevExpress.XtraBars.Ribbon;

// Merge Ribbon Controls when a child form is maximized
RibbonControl1.MdiMergeStyle = DevExpress.XtraBars.Ribbon.RibbonMdiMergeStyle.OnlyWhenMaximized;

// Manually merge the status bars of the parent and child MDI forms.
private void RibbonControl1_Merge(object sender, RibbonMergeEventArgs e) {
    RibbonControl parentRRibbon = sender as RibbonControl;
    RibbonControl childRibbon = e.MergedChild;
    parentRRibbon.StatusBar.MergeStatusBar(childRibbon.StatusBar);
}
// Manually unmerge the status bars.
private void RibbonControl1_UnMerge(object sender, RibbonMergeEventArgs e) {
    RibbonControl parentRRibbon = sender as RibbonControl;            
    parentRRibbon.StatusBar.UnMergeStatusBar();
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Merge event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also