windowsforms-devexpress-dot-xtrabars-dot-ribbon-dot-ribboncontrol-b06547b2.md
Allows you to perform additional customizations after another Ribbon Control has been unmerged from the current RibbonControl.
Namespace : DevExpress.XtraBars.Ribbon
Assembly : DevExpress.XtraBars.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[DXCategory("Merge")]
public event RibbonMergeEventHandler UnMerge
<DXCategory("Merge")>
Public Event UnMerge As RibbonMergeEventHandler
The UnMerge 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. |
In MDI applications, Ribbon Controls of child and main MDI forms can be merged according to the RibbonControl.MdiMergeStyle property of the main Ribbon Control object. This property also determines when the unmerge mechanism is invoked, restoring the original layout of bar commands within the main and child Ribbon Controls. The UnMerge event fires after the main and child Ribbon Controls have been unmerged.
RibbonStatusBar objects within the main and child MDI forms are not merged automatically. To merge them, handle the RibbonControl.Merge event and call the RibbonStatusBar.MergeStatusBar methods. To unmerge them (restore the original layout of status bars), handle the UnMerge event and call the RibbonStatusBar.UnMergeStatusBar method.
See Ribbon Merging to learn more.
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();
}
Imports DevExpress.XtraBars.Ribbon
' Merge Ribbon Controls when a child form is maximized
Private RibbonControl1.MdiMergeStyle = _
DevExpress.XtraBars.Ribbon.RibbonMdiMergeStyle.OnlyWhenMaximized
' Manually merge the status bars of the parent and child MDI forms.
Private Sub RibbonControl1_Merge(ByVal sender As System.Object, _
ByVal e As RibbonMergeEventArgs) Handles RibbonControl1.Merge
Dim parentRRibbon As RibbonControl = TryCast(sender, RibbonControl)
Dim childRibbon As RibbonControl = e.MergedChild
parentRRibbon.StatusBar.MergeStatusBar(childRibbon.StatusBar)
End Sub
' Manually unmerge the status bars.
Private Sub RibbonControl1_UnMerge(ByVal sender As System.Object, _
ByVal e As RibbonMergeEventArgs) Handles RibbonControl1.UnMerge
Dim parentRRibbon As RibbonControl = TryCast(sender, RibbonControl)
parentRRibbon.StatusBar.UnMergeStatusBar()
End Sub
See Also