Skip to main content
A newer version of this page is available. .

Bar.UnMerge() Method

Restores the links layout of the current bar after another bar has been merged with it.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v19.1.dll

Declaration

public void UnMerge()

Remarks

In an MDI application, XtraBars give you the ability to merge the bars of parent and child MDI forms, i.e. combine bar links belonging to different Bar Managers.

The merge mechanism is invoked according to the BarManager.MdiMenuMergeStyle property value. It allows you to disable merge operations, enable merging when a child form is activated or enable merging when a child form is maximized. For the last two mentioned options, the corresponding unmerge mechanism is invoked when an MDI child becomes inactive or when a child form is restored from its minimized or maximized view.

The UnMerge method restores the bar’s layout after the previous merge operation. Usually, you place the method call within an BarManager.UnMerge event handler.

See the Bar.Merge topic for more information.

Example

Assume you have parent and child MDI forms. On each one you place a Bar Manager and create an Edit toolbar. When the child MDI form is activated, we want to merge these toolbars (XtraBars supports automatic merging of main menus only). For this purpose, the BarManager.Merge event is handled. Toolbars are merged using the Bar.Merge method.

When the child form becomes inactive (for instance, focus may move to another form), we need to restore the original main menu layout of the parent form. For this purpose, the Bar.UnMerge method is called in an BarManager.UnMerge event handler.

using DevExpress.XtraBars;

private void barManager1_Merge(object sender, BarManagerMergeEventArgs e) {
    BarManager parentBarManager = sender as BarManager;
    Bar childBar = e.ChildManager.Bars["Edit"];
    Bar parentBar = parentBarManager.Bars["Edit"];
    parentBar.Merge(childBar);            
}

private void barManager1_UnMerge(object sender, BarManagerMergeEventArgs e) {
    BarManager parentBarManager = sender as BarManager;
    Bar parentBar = parentBarManager.Bars["Edit"];
    parentBar.UnMerge();
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the UnMerge() method.

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