Skip to main content

RibbonControl.MdiMergeStyle Property

Gets or sets if and when a merge mechanism is invoked in an MDI application.

Namespace: DevExpress.XtraBars.Ribbon

Assembly: DevExpress.XtraBars.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DefaultValue(RibbonMdiMergeStyle.Default)]
[DXCategory("Behavior")]
[XtraSerializableProperty]
public RibbonMdiMergeStyle MdiMergeStyle { get; set; }

Property Value

Type Default Description
RibbonMdiMergeStyle Default

A RibbonMdiMergeStyle value that specifies when merge operations must be performed.

Available values:

Name Description
Default

The same as the RibbonMdiMergeStyle.OnlyWhenMaximized option.

Always

Specifies that the merge mechanism should be invoked when a child MDI form is activated. The unmerge mechanism is invoked when a child form becomes inactive.

Never

Specifies that the merge mechanism is never invoked.

OnlyWhenMaximized

Specifies that the merge mechanism should be invoked when a child MDI form is maximized. The unmerge mechanism is invoked when a child form is restored from the maximized view.

Remarks

In MDI applications, Ribbon Controls support the merge functionality allowing you to combine commands of Ribbon Controls displayed within parent and child MDI forms.

The MdiMergeStyle property of the main form’s Ribbon Control determines if and when merge and unmerge mechanisms are invoked. By default, the merge mechanism is automatically invoked when a child MDI form is maximized. Similarly, when the form is restored, the unmerge mechanism is invoked.

During merging, RibbonStatusBar objects are not merged/unmerged automatically. To merge and unmerge them manually, use the RibbonStatusBar.MergeStatusBar and RibbonStatusBar.UnMergeStatusBar methods. You can call this method within the RibbonControl.Merge and RibbonControl.UnMerge events, that fire after the merge and unmerge mechanism are invoked.

The bar items’ BarItem.MergeType properties determine how items are merged. This specifies whether the new items should be appended to the original items, replace them, etc.

See Ribbon Merging to learn more.

Example

This example demonstrates the merging mechanism for RibbonControls in action. The main and child MDI forms contain RibbonControls. The child form's RibbonControl is merged into the main form's RibbonControl when the child form is maximized.

View Example

private void Form1_Load(object sender, EventArgs e) {
    // Enable the form's title bar transparency
    //this.AllowFormGlass = DevExpress.Utils.DefaultBoolean.False;
    // Specify that the merge mechanism should be invoked when a child MDI form is maximized.
    this.ribbonControl1.MdiMergeStyle = RibbonMdiMergeStyle.OnlyWhenMaximized;
    CreateChildForm();
}
private void btnNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
    CreateChildForm();
}
int ctr = 1;
void CreateChildForm() {
    // Create an MDI child form, containing a RibbonControl
    ReportForm child = new ReportForm();
    child.Text = "Report " + ctr.ToString();
    child.MdiParent = this;
    child.Show();
    ctr++;
}

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

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