Skip to main content

RibbonPageCategoryBase.MergeType Property

Gets or sets the way ribbon categories 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 categories 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 categories of two ribbon controls merge:

Add

Ribbon Category Merging - MergeType.Add

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>
            <!-- Parent Ribbon's Category -->
            <dxr:RibbonPageCategory Caption="Text">
                <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>
                                <!-- Child Ribbon's Category -->
                                <dxr:RibbonPageCategory Caption="Text" MergeType="Add">
                                    <dxr:RibbonPage Caption="File">
                                        <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>
            <!-- Parent Ribbon's Category -->
            <dxr:RibbonPageCategory Caption="Text">
                <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>
                                <!-- Child Ribbon's Category -->
                                <dxr:RibbonPageCategory Caption="Text" MergeType="MergeItems">
                                    <dxr:RibbonPage Caption="File">
                                        <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>
            <!-- Parent Ribbon's Category -->
            <dxr:RibbonPageCategory Caption="Text">
                <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>
                                <!-- Child Ribbon's Category -->
                                <dxr:RibbonPageCategory Caption="Text" MergeType="Remove">
                                    <dxr:RibbonPage Caption="File">
                                        <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>

Replace

Ribbon Category 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>
            <!-- Parent Ribbon's Category -->
            <dxr:RibbonPageCategory Caption="Text">
                <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>
                                <!-- Child Ribbon's Category -->
                                <dxr:RibbonPageCategory Caption="Text" MergeType="Replace">
                                    <dxr:RibbonPage Caption="File">
                                        <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>
See Also