Skip to main content

ToolbarFormControl.MdiMergeStyle Property

Gets or sets whether bar items in the parent and child form’s title bar are merged when the child form is maximized, focused, or never merged.

Namespace: DevExpress.XtraBars.ToolbarForm

Assembly: DevExpress.XtraBars.v24.2.dll

Declaration

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

Property Value

Type Default Description
ToolbarFormMdiMergeStyle Default

A value that specifies when to merge title bars.

Available values:

Name Description
Default

The mode is not specified explicitly. Enables the OnlyWhenMaximized mode.

Always

Title bars are merged when a child form is focused.

Never

Title bars are never merged.

OnlyWhenMaximized

Title bars are merged when a child form is maximized.

Remarks

In an MDI application, when a child toolbar form is maximized, its bar items in the title bar are merged with the parent form’s bar items. Use the MdiMergeStyle property to specify whether bar items are merged when a child form is maximized, focused, or never merged.

The parent and child title bars fire the Merge and UnMerge events after the bar items are merged.

Example

If the parent form and a child form contain bar items with equal captions (for example, File), you can remove the duplicated command from the merged title bar as the code below demonstrates.

private void ToolbarFormControl1_Merge(object sender, DevExpress.XtraBars.ToolbarForm.ToolbarFormMergeEventArgs e) {
    e.MergeOwner.TitleItemLinks
        .GroupBy(x => x.Caption)
        .Where(x => x.Count() > 1)
        .ForEach(x => x
        .ForEach(y => {
            if (e.MergedChild.TitleItemLinks.Where(z => z.Item == y.Item).Count() != 0)
                y.Visible = false;
        }));
}
See Also