RichTextBox for WPF | ComponentOne
In This Topic
    Working with RichTextBox Ribbon
    In This Topic

    RichTextBoxRibbon is a ribbon control that has been designed to work with the commands of RichTextBox. Once you add the C1.WPF.RichTextBox.Ribbon nuget package, C1RichTextBoxRibbon gets automatically added in the Visual Studio Toolbox automatically. This control is represented by the C1RichTextBoxRibbon class.

    This gif shows the working of ribbon in rixhtextbox

    Note: The RichTextBoxRibbon is available only in .NET. For .NET Framework, RichTextBox provides the C1SimplifiedRichTextBox and C1RichTextBoxToolbar.

    The RichTextBox Ribbon UI has predefined elements such as Ribbon tab, Ribbon Group, and other Ribbon Items, The Ribbon group and tab controls are represented by RibbonTabItem and RibbonGroup classes. Moreover, the tabs, groups and all ribbon items in the Ribbon UI is easily editable in the designer. Also, you can use the Reset tools option in the context menu of RichTextBox.Ribbon to get the original layout of the tools in the Ribbon.

    A snapshot of context menu

    When a RichTextBoxRibbon control is dragged onto the form, the following XAML lines are generated:

    XAML
    Copy Code
    <c1:C1RichTextBoxRibbon VerticalAlignment="Top" SelectedIndex="2">
                <c1:RibbonTabItem Header="Home">
                    <c1:RibbonGroup Header="Edit">
                        <c1:C1PasteTool/>
                        <c1:C1CutTool/>
                        <c1:C1UndoTool/>
                        <c1:C1ToolSeparator/>
                        <c1:C1CopyTool/>
                        <c1:C1RedoTool/>
                    </c1:RibbonGroup>
                    <c1:RibbonGroup Header="Font">
                        <c1:C1ToolStrip>
                            <c1:C1FontFamilyTool/>
                            <c1:C1FontSizeTool/>
                            <c1:C1IncreaseFontSizeTool/>
                            <c1:C1DecreaseFontSizeTool/>
                        </c1:C1ToolStrip>
                        <c1:C1ToolStrip>
                            <c1:C1BoldTool/>
                            <c1:C1ItalicTool/>
                            <c1:C1UnderlineTool/>
                            <c1:C1StrikethroughTool/>
                            <c1:C1ToolSeparator/>
                            <c1:C1ChangeCaseTool/>
                            <c1:C1SuperscriptTool/>
                            <c1:C1SubscriptTool/>
                            <c1:C1ToolSeparator/>
                            <c1:C1FontColorTool/>
                            <c1:C1TextHighlightTool/>
                        </c1:C1ToolStrip>
                    </c1:RibbonGroup>
                    <c1:RibbonGroup Header="Paragraph">
                        <c1:C1ToolStrip>
                            <c1:C1LeftAlignTool/>
                            <c1:C1CenterAlignTool/>
                            <c1:C1RightAlignTool/>
                            <c1:C1JustifyTool/>
                            <c1:C1ToolSeparator/>
                            <c1:C1BulletsTool/>
                            <c1:C1NumberingTool/>
                            <c1:C1ToolSeparator/>
                            <c1:C1TextWrappingTool/>
                        </c1:C1ToolStrip>
                        <c1:C1ToolStrip>
                            <c1:C1ParagraphColorTool/>
                            <c1:C1BorderMenuTool/>
                            <c1:C1MarginTool/>
                            <c1:C1PaddingTool/>
                            <c1:C1ToolSeparator/>
                            <c1:C1LineSpacingTool/>
                        </c1:C1ToolStrip>
                    </c1:RibbonGroup>
                    <c1:RibbonGroup Header="Insert">
                        <c1:C1InsertImageTool/>
                        <c1:C1InsertSymbolTool/>
                        <c1:C1InsertHyperlinkTool/>
                        <c1:C1RemoveHyperlinkTool/>
                    </c1:RibbonGroup>
                    <c1:RibbonGroup Header="Tools">
                        <c1:RibbonGroup.GroupSizeDefinitions>
                            <c1:RibbonGroupSizeDefinition>
                                <c1:RibbonToolSizeDefinition Size="Large"/>
                            </c1:RibbonGroupSizeDefinition>
                        </c1:RibbonGroup.GroupSizeDefinitions>
                        <c1:C1FindAndReplaceTool/>
                    </c1:RibbonGroup>
                </c1:RibbonTabItem>
                <c1:RibbonTabItem Header="Tables">
                    <c1:RibbonGroup Header="Table">
                        <c1:RibbonGroup.GroupSizeDefinitions>
                            <c1:RibbonGroupSizeDefinition>
                                <c1:RibbonToolSizeDefinition Size="Large"/>
                            </c1:RibbonGroupSizeDefinition>
                        </c1:RibbonGroup.GroupSizeDefinitions>
                        <c1:C1InsertTableTool/>
                        <c1:C1SelectTableMenuTool/>
                        <c1:C1ShowGridlinesTool/>
                        <c1:C1TableWidthTool/>
                    </c1:RibbonGroup>
                    <c1:RibbonGroup Header="Rows And Columns">
                        <c1:RibbonGroup.GroupSizeDefinitions>
                            <c1:RibbonGroupSizeDefinition>
                                <c1:RibbonToolSizeDefinition Size="Large"/>
                            </c1:RibbonGroupSizeDefinition>
                        </c1:RibbonGroup.GroupSizeDefinitions>
                        <c1:C1DeleteTableMenuTool/>
                        <c1:C1InsertColumnsLeftTool/>
                        <c1:C1InsertColumnsRightTool/>
                        <c1:C1InsertRowsAboveTool/>
                        <c1:C1InsertRowsBelowTool/>
                    </c1:RibbonGroup>
                    <c1:RibbonGroup Header="Merge">
                        <c1:RibbonGroup.GroupSizeDefinitions>
                            <c1:RibbonGroupSizeDefinition>
                                <c1:RibbonToolSizeDefinition Size="Large"/>
                            </c1:RibbonGroupSizeDefinition>
                        </c1:RibbonGroup.GroupSizeDefinitions>
                        <c1:C1MergeCellsTool/>
                        <c1:C1UnmergeCellTool/>
                    </c1:RibbonGroup>
                    <c1:RibbonGroup Header="Cell">
                        <c1:RibbonGroup.GroupSizeDefinitions>
                            <c1:RibbonGroupSizeDefinition>
                                <c1:RibbonToolSizeDefinition Size="Small"/>
                            </c1:RibbonGroupSizeDefinition>
                        </c1:RibbonGroup.GroupSizeDefinitions>
                        <c1:C1ColumnWidthTool/>
                        <c1:C1RowHeightTool/>
                        <c1:C1ToolSeparator/>
                        <c1:C1TopAlignTool/>
                        <c1:C1VerticalCenterAlignTool/>
                        <c1:C1BottomAlignTool/>
                    </c1:RibbonGroup>
                </c1:RibbonTabItem>
                <c1:RibbonTabItem Header="View">
                    <c1:RibbonGroup Header="Document">
                        <c1:RibbonGroup.GroupSizeDefinitions>
                            <c1:RibbonGroupSizeDefinition>
                                <c1:RibbonToolSizeDefinition Size="Large"/>
                            </c1:RibbonGroupSizeDefinition>
                        </c1:RibbonGroup.GroupSizeDefinitions>
                        <c1:C1PrintViewTool/>
                        <c1:C1DraftViewTool/>
                    </c1:RibbonGroup>
                    <c1:RibbonGroup Header="Zoom">
                        <c1:RibbonGroup.GroupSizeDefinitions>
                            <c1:RibbonGroupSizeDefinition>
                                <c1:RibbonToolSizeDefinition Size="Large"/>
                                <c1:RibbonToolSizeDefinition Size="Large"/>
                                <c1:RibbonToolSizeDefinition Size="Large"/>
                                <c1:RibbonToolSizeDefinition Size="Small"/>
                                <c1:RibbonToolSizeDefinition Size="Small"/>
                                <c1:RibbonToolSizeDefinition Size="Small"/>
                            </c1:RibbonGroupSizeDefinition>
                        </c1:RibbonGroup.GroupSizeDefinitions>
                        <c1:C1ZoomInTool/>
                        <c1:C1ZoomOutTool/>
                        <c1:C1Zoom100PercentTool/>
                        <c1:C1OnePageTool/>
                        <c1:C1TwoPagesTool/>
                        <c1:C1FitWidthTool/>
                    </c1:RibbonGroup>
                    <c1:RibbonGroup Header="Line Number">
                        <c1:RibbonGroup.GroupSizeDefinitions>
                            <c1:RibbonGroupSizeDefinition>
                                <c1:RibbonToolSizeDefinition Size="Small"/>
                            </c1:RibbonGroupSizeDefinition>
                        </c1:RibbonGroup.GroupSizeDefinitions>
                        <c1:C1LineNumberTool/>
                    </c1:RibbonGroup>
                </c1:RibbonTabItem>
            </c1:C1RichTextBoxRibbon>