# Create a Ribbon Application With Sidebar Support

> Build a word processor with a ribbon and a Styles sidebar, open sidebars from ribbon buttons, convert the form to a RibbonForm and add a Table Tools tab.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET for Windows Forms > Getting Started > Document Editor > Create a Ribbon Application With Sidebar Support
- **1686 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/ribbon-sidebar/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/ribbon-sidebar/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/ribbon-sidebar/llms-full.txt

---

A ribbon application looks and works like a current word processor: tabs of commands at the top, panels such as styles or comments beside the document, and tabs that appear only while you work in a table. Built on the editor of your first application, it gets a sidebar with the document's styles, ribbon buttons that open sidebars, a `RibbonForm` with a Quick Access Toolbar, and a contextual **Table Tools** tab.

### Prerequisites

- A Windows Forms project with the package `TXTextControl.TextControl.WinForms.SDK` and a `TextControl` on **Form1**, as created in the first three sections of [Create Your First Windows Forms Application](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/first-application/llms-full.txt).
- The Enterprise or Professional edition, which includes the ribbon. See [Editions and Feature Availability](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/overview/editions/llms-full.txt).

### Add the Ribbon and the Bars

The sidebar goes next to the ribbon, the rulers and the status bar of your first application. If you completed the first tutorial, these controls are already on the form. Otherwise, add them with the smart tags of the `TextControl` and the ribbon, as in steps 3 and 4 of [Add the Editor to the Form](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/first-application/#add-the-editor-to-the-form) and in [Add the Ribbon Tabs](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/first-application/#add-the-ribbon-tabs).

### Add a Sidebar

1. Click the smart tag of the `TextControl` again and click **Add a Right Sidebar**.

    ![The TextControl Tasks smart tag with the wizards Add a Left Sidebar and Add a Right Sidebar marked.](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-winforms/smart-tag-add-sidebar.c00f5f17.webp)
2. Click **Arrange Controls Automatically** again, so that the sidebar is docked at the right side of the editor.
3. Click the smart tag in the upper right corner of the sidebar and select **Styles** as the **ContentLayout**.

    ![The Sidebar Tasks smart tag with the ContentLayout drop-down open and Styles selected, next to the Styles sidebar in the designer.](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-winforms/sidebar-content-layout.0e176eb7.webp)

Press **F5**. The ribbon, the rulers and the status bar surround the editor, and the sidebar at the right lists the styles of the document.

![The running application with the Home tab of the ribbon, the rulers, the page and, at the right, the Styles sidebar listing Normal and Default Paragraph Font with the options Show Preview and Sort Alphabetical and the Manage Styles button.](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-winforms/ribbon-styles-sidebar.5a81e09f.webp)

The sidebar has other panels as well, such as **Find**, **Replace**, **TrackedChanges** and **Comments**. [Sidebar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/overview/components/sidebar/llms-full.txt) describes all of them.

### Open Sidebars From Ribbon Buttons

Ribbon buttons such as **Find**, **Replace** and **Comments** can open their panel in a sidebar. The connection is a property of the ribbon tab:

1. Select the **Home** tab of the ribbon, the `RibbonFormattingTab`, in the designer.
2. In the **Properties** window, set **FindSidebar** and **ReplaceSidebar** to the sidebar you added.
3. Select the **Proofing** tab, the `RibbonProofingTab`, and set **CommentsSidebar** and **TrackedChangesSidebar** to the same sidebar.
4. Select the sidebar and clear **IsShown** in its smart tag, so that it is hidden until a button opens it.

Now the sidebar opens when the user clicks one of these buttons, with the panel of that button. The same connections in code are shown in [Sidebar and Panels](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/sidebar/#open-sidebars-with-ribbon-buttons).

### Convert the Form to a RibbonForm

Select the ribbon, open its smart tag and click **Convert to a RibbonForm**. The form now derives from [RibbonForm](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/ribbonform/llms-full.txt), which draws the Quick Access Toolbar and the headers of contextual tabs in its title bar, as the next section uses.

### Add a Table Tools Tab

A contextual tab group is a set of tabs that is shown only in a certain context. The following steps add a **Table Tools** group that appears while the input position is in a table:

1. Select the ribbon and find **ContextualTabGroups** in the **Properties** window. Click the ellipsis button to open the collection editor.
2. Click **Add**. Name the new group `m_grpTableTools`, set its **Header** to **Table Tools** and choose a **BackColor**.
3. Click the ellipsis button of its **ContextualTabs** property, open the **Add** drop-down, click **RibbonTableLayoutTab** and close both editors with **OK**.
4. Add the following code to *Form1.cs*:

```csharp
public partial class Form1 : TXTextControl.Windows.Forms.Ribbon.RibbonForm
{
    public Form1()
    {
        InitializeComponent();
        textControl1.InputPositionChanged += TextControl1_InputPositionChanged;
    }

    private void TextControl1_InputPositionChanged(object sender, EventArgs e)
    {
        // Show Table Tools only while the input position is in a table
        m_grpTableTools.Visible = textControl1.Tables.GetItem() != null;
    }
}
```

1. Press **F5**, insert a table with the **Table** button of the **Insert** tab and click into it. The **Table Tools** header appears in the title bar with the table layout tab.

The code works as follows:

- [InputPositionChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/inputpositionchanged-event/llms-full.txt) occurs each time the input position moves.
- [Tables.GetItem](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/tablecollection/getitem-method/llms-full.txt) returns the table at the input position, or `null` outside a table.
- [Visible](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/contextualtabgroup/visible-property/llms-full.txt) shows or hides the [ContextualTabGroup](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-windows-forms-ribbon/contextualtabgroup/llms-full.txt).

### The TX Words Sample

The setup installs a complete ribbon application with a bottom, a left and a right sidebar and contextual tabs for tables and frames, on a `RibbonForm`. Its source code is in *%USERPROFILE%\\Documents\\TX Text Control 34.0.NET for Windows Forms\\CSharp\\TX Words\\Ribbon*.

### Next Steps

- [Load and Save Documents](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/load-save/llms-full.txt): open and save documents from your own buttons or menus.
- [Ribbon and UI](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/llms-full.txt): built-in tabs, custom commands, sidebars and localization in detail.
- [Built-in Ribbon Tabs](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/ribbon/llms-full.txt) and [Custom Tabs and Commands](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/custom-tabs/llms-full.txt): the predefined tabs and custom tabs.
- The blog article [Getting Started: Creating a .NET 8 Windows Forms Ribbon Application with Sidebar Support](https://www.textcontrol.com/blog/2024/02/28/getting-started-creating-a-net-8-windows-forms-ribbon-application-with-sidebar-support/): the same steps with screenshots.

---

## Nearby

- **Previous:** [Add Rulers, Toolbars, and a Status Bar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/rulers-toolbars/llms-full.txt)
- **Next:** [Load and Save Documents](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/load-save/llms-full.txt)
