Skip to main content

RibbonPage.MergeType Property

Gets or sets the way ribbon pages merge. This is a dependency property.

Namespace: DevExpress.Xpf.Ribbon

Assembly: DevExpress.Xpf.Ribbon.v24.2.dll

NuGet Package: DevExpress.Wpf.Ribbon

Declaration

public RibbonMergeType MergeType { get; set; }

Property Value

Type Description
RibbonMergeType

A RibbonMergeType value indicating how ribbon pages merge.

Available values:

Name Description
Add

Adds a child ribbon element to a parent ribbon even if an element with the same caption already exists in the parent ribbon.

Replace

Replaces a parent ribbon element with the current child ribbon element if they have the same caption.

If a parent element with the same caption is not found, the current child ribbon element is added to the parent ribbon.

MergeItems

The default merging mechanism. Sub-items of the current child ribbon element are merged into the parent ribbon element that has the same caption. If no parent element with the same caption exists, the current child ribbon element is appended according to its MergeOrder.

Remove

Prevents the current child ribbon element from being merged with a parent ribbon object.

If the MergeType for a parent element is set to Remove, this element is hidden after the merge is complete.

Remarks

Use the MergeType property to adjust the way ribbon pages of two ribbon controls merge:

Add

Ribbon Page Merging - MergeType.Add

You can set the UseCaptionToIdentifyPagesOnMerging static property to false to avoid possible merging issues.

Show Code
<dx:ThemedWindow ...
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
    xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
    xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
    xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon">
    <DockPanel>
        <dxr:RibbonControl>
            <dxr:RibbonPageCategory Caption="Text">
                <!-- Parent Ribbon's Page -->
                <dxr:RibbonPage Caption="File">
                    <dxr:RibbonPageGroup Caption="File">
                        <dxb:BarButtonItem
                            Content="New"
                            LargeGlyph="{dx:DXImage Image=New_32x32.png}"
                            MergeOrder="0" />
                        <dxb:BarButtonItem
                            Content="Open"
                            Glyph="{dx:DXImage Image=Open_16x16.png}"
                            MergeOrder="1" />
                        <dxb:BarButtonItem
                            Content="Save"
                            Glyph="{dx:DXImage Image=Save_16x16.png}"
                            MergeOrder="2" />
                        <dxb:BarButtonItem
                            Content="Save As"
                            Glyph="{dx:DXImage Image=SaveAs_16x16.png}"
                            MergeOrder="3" />
                    </dxr:RibbonPageGroup>
                </dxr:RibbonPage>
            </dxr:RibbonPageCategory>
            <dxr:RibbonDefaultPageCategory>
                <!-- ... -->
            </dxr:RibbonDefaultPageCategory>
        </dxr:RibbonControl>
        <dxdo:DockLayoutManager>
            <dxdo:LayoutGroup>
                <dxdo:DocumentGroup>
                    <dxdo:DocumentPanel Caption="Document1">
                        <DockPanel>
                            <dxr:RibbonControl>
                                <dxr:RibbonPageCategory Caption="Text">
                                    <!-- Child Ribbon's Page -->
                                    <dxr:RibbonPage Caption="File" MergeType="Add">
                                        <dxr:RibbonPageGroup Caption="File">
                                            <dxb:BarButtonItem
                                                Content="Open"
                                                Glyph="{dx:DXImage Image=Open_16x16.png}"
                                                MergeOrder="1" />
                                            <dxb:BarButtonItem
                                                Content="Save"
                                                Glyph="{dx:DXImage Image=Save_16x16.png}"
                                                MergeOrder="2" />
                                            <dxb:BarButtonItem
                                                Content="Save As"
                                                Glyph="{dx:DXImage Image=SaveAs_16x16.png}"
                                                MergeOrder="3" />
                                        </dxr:RibbonPageGroup>
                                    </dxr:RibbonPage>
                                </dxr:RibbonPageCategory>
                                <dxr:RibbonDefaultPageCategory>
                                    <!-- ... -->
                                </dxr:RibbonDefaultPageCategory>
                            </dxr:RibbonControl>
                            <TextBox/>
                        </DockPanel>
                    </dxdo:DocumentPanel>
                </dxdo:DocumentGroup>
            </dxdo:LayoutGroup>
        </dxdo:DockLayoutManager>
    </DockPanel>
</dx:ThemedWindow>
public partial class App : Application {
   protected override void OnStartup(StartupEventArgs e) {
       RibbonControl.UseCaptionToIdentifyPagesOnMerging = false;
       base.OnStartup(e);
   }
}

Replace

Ribbon Page Merging - MergeType.Replace

Show Code
<dx:ThemedWindow ...
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
    xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
    xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
    xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon">
    <DockPanel>
        <dxr:RibbonControl>
            <dxr:RibbonPageCategory Caption="Text">
                <!-- Parent Ribbon's Page -->
                <dxr:RibbonPage Caption="File">
                    <dxr:RibbonPageGroup Caption="File">
                        <dxb:BarButtonItem
                            Content="New"
                            LargeGlyph="{dx:DXImage Image=New_32x32.png}"
                            MergeOrder="0" />
                        <dxb:BarButtonItem
                            Content="Open"
                            Glyph="{dx:DXImage Image=Open_16x16.png}"
                            MergeOrder="1" />
                        <dxb:BarButtonItem
                            Content="Save"
                            Glyph="{dx:DXImage Image=Save_16x16.png}"
                            MergeOrder="2" />
                        <dxb:BarButtonItem
                            Content="Save As"
                            Glyph="{dx:DXImage Image=SaveAs_16x16.png}"
                            MergeOrder="3" />
                    </dxr:RibbonPageGroup>
                </dxr:RibbonPage>
            </dxr:RibbonPageCategory>
            <dxr:RibbonDefaultPageCategory>
                <!-- ... -->
            </dxr:RibbonDefaultPageCategory>
        </dxr:RibbonControl>
        <dxdo:DockLayoutManager>
            <dxdo:LayoutGroup>
                <dxdo:DocumentGroup>
                    <dxdo:DocumentPanel Caption="Document1">
                        <DockPanel>
                            <dxr:RibbonControl>
                                <dxr:RibbonPageCategory Caption="Text">
                                    <!-- Child Ribbon's Page -->
                                    <dxr:RibbonPage Caption="File" MergeType="Replace">
                                        <dxr:RibbonPageGroup Caption="File">
                                            <dxb:BarButtonItem
                                                Content="Open"
                                                Glyph="{dx:DXImage Image=Open_16x16.png}"
                                                MergeOrder="1" />
                                            <dxb:BarButtonItem
                                                Content="Save"
                                                Glyph="{dx:DXImage Image=Save_16x16.png}"
                                                MergeOrder="2" />
                                            <dxb:BarButtonItem
                                                Content="Save As"
                                                Glyph="{dx:DXImage Image=SaveAs_16x16.png}"
                                                MergeOrder="3" />
                                        </dxr:RibbonPageGroup>
                                    </dxr:RibbonPage>
                                </dxr:RibbonPageCategory>
                                <dxr:RibbonDefaultPageCategory>
                                    <!-- ... -->
                                </dxr:RibbonDefaultPageCategory>
                            </dxr:RibbonControl>
                            <TextBox/>
                        </DockPanel>
                    </dxdo:DocumentPanel>
                </dxdo:DocumentGroup>
            </dxdo:LayoutGroup>
        </dxdo:DockLayoutManager>
    </DockPanel>
</dx:ThemedWindow>

MergeItems

Ribbon Category Merging - MergeType.MergeItems

Show Code
<dx:ThemedWindow ...
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
    xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
    xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
    xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon">
    <DockPanel>
        <dxr:RibbonControl>
            <dxr:RibbonPageCategory Caption="Text">
                <!-- Parent Ribbon's Page -->
                <dxr:RibbonPage Caption="File">
                    <dxr:RibbonPageGroup Caption="File">
                        <dxb:BarButtonItem
                            Content="New"
                            LargeGlyph="{dx:DXImage Image=New_32x32.png}"
                            MergeOrder="0" />
                        <dxb:BarButtonItem
                            Content="Open"
                            Glyph="{dx:DXImage Image=Open_16x16.png}"
                            MergeOrder="1" />
                        <dxb:BarButtonItem
                            Content="Save"
                            Glyph="{dx:DXImage Image=Save_16x16.png}"
                            MergeOrder="2" />
                        <dxb:BarButtonItem
                            Content="Save As"
                            Glyph="{dx:DXImage Image=SaveAs_16x16.png}"
                            MergeOrder="3" />
                    </dxr:RibbonPageGroup>
                </dxr:RibbonPage>
            </dxr:RibbonPageCategory>
            <dxr:RibbonDefaultPageCategory>
                <!-- ... -->
            </dxr:RibbonDefaultPageCategory>
        </dxr:RibbonControl>
        <dxdo:DockLayoutManager>
            <dxdo:LayoutGroup>
                <dxdo:DocumentGroup>
                    <dxdo:DocumentPanel Caption="Document1">
                        <DockPanel>
                            <dxr:RibbonControl>
                                <dxr:RibbonPageCategory Caption="Text">
                                    <!-- Child Ribbon's Page -->
                                    <dxr:RibbonPage Caption="File" MergeType="MergeItems">
                                        <dxr:RibbonPageGroup Caption="File">
                                            <dxb:BarButtonItem
                                                Content="Open"
                                                Glyph="{dx:DXImage Image=Open_16x16.png}"
                                                MergeOrder="1" />
                                            <dxb:BarButtonItem
                                                Content="Save"
                                                Glyph="{dx:DXImage Image=Save_16x16.png}"
                                                MergeOrder="2" />
                                            <dxb:BarButtonItem
                                                Content="Save As"
                                                Glyph="{dx:DXImage Image=SaveAs_16x16.png}"
                                                MergeOrder="3" />
                                        </dxr:RibbonPageGroup>
                                    </dxr:RibbonPage>
                                </dxr:RibbonPageCategory>
                                <dxr:RibbonDefaultPageCategory>
                                    <!-- ... -->
                                </dxr:RibbonDefaultPageCategory>
                            </dxr:RibbonControl>
                            <TextBox/>
                        </DockPanel>
                    </dxdo:DocumentPanel>
                </dxdo:DocumentGroup>
            </dxdo:LayoutGroup>
        </dxdo:DockLayoutManager>
    </DockPanel>
</dx:ThemedWindow>

Remove

Ribbon Category Merging - MergeType.Remove

Show Code
<dx:ThemedWindow ...
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
    xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
    xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
    xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon">
    <DockPanel>
        <dxr:RibbonControl>
            <dxr:RibbonPageCategory Caption="Text">
                <!-- Parent Ribbon's Page -->
                <dxr:RibbonPage Caption="File">
                    <dxr:RibbonPageGroup Caption="File">
                        <dxb:BarButtonItem
                            Content="New"
                            LargeGlyph="{dx:DXImage Image=New_32x32.png}"
                            MergeOrder="0" />
                        <dxb:BarButtonItem
                            Content="Open"
                            Glyph="{dx:DXImage Image=Open_16x16.png}"
                            MergeOrder="1" />
                        <dxb:BarButtonItem
                            Content="Save"
                            Glyph="{dx:DXImage Image=Save_16x16.png}"
                            MergeOrder="2" />
                        <dxb:BarButtonItem
                            Content="Save As"
                            Glyph="{dx:DXImage Image=SaveAs_16x16.png}"
                            MergeOrder="3" />
                    </dxr:RibbonPageGroup>
                </dxr:RibbonPage>
            </dxr:RibbonPageCategory>
            <dxr:RibbonDefaultPageCategory>
                <!-- ... -->
            </dxr:RibbonDefaultPageCategory>
        </dxr:RibbonControl>
        <dxdo:DockLayoutManager>
            <dxdo:LayoutGroup>
                <dxdo:DocumentGroup>
                    <dxdo:DocumentPanel Caption="Document1">
                        <DockPanel>
                            <dxr:RibbonControl>
                                <dxr:RibbonPageCategory Caption="Text">
                                    <!-- Child Ribbon's Page -->
                                    <dxr:RibbonPage Caption="File" MergeType="Remove">
                                        <dxr:RibbonPageGroup Caption="File">
                                            <dxb:BarButtonItem
                                                Content="Open"
                                                Glyph="{dx:DXImage Image=Open_16x16.png}"
                                                MergeOrder="1" />
                                            <dxb:BarButtonItem
                                                Content="Save"
                                                Glyph="{dx:DXImage Image=Save_16x16.png}"
                                                MergeOrder="2" />
                                            <dxb:BarButtonItem
                                                Content="Save As"
                                                Glyph="{dx:DXImage Image=SaveAs_16x16.png}"
                                                MergeOrder="3" />
                                        </dxr:RibbonPageGroup>
                                    </dxr:RibbonPage>
                                </dxr:RibbonPageCategory>
                                <dxr:RibbonDefaultPageCategory>
                                    <!-- ... -->
                                </dxr:RibbonDefaultPageCategory>
                            </dxr:RibbonControl>
                            <TextBox/>
                        </DockPanel>
                    </dxdo:DocumentPanel>
                </dxdo:DocumentGroup>
            </dxdo:LayoutGroup>
        </dxdo:DockLayoutManager>
    </DockPanel>
</dx:ThemedWindow>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the MergeType 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