TX Text Control .NET for Windows Forms

Sidebar

Topic

Word processors show search results, styles, comments and tracked changes in panels beside the document instead of in dialog boxes, and the Sidebar gives your Windows Forms application such panels. Read on for the panels it provides, how users pin it or open it as a dialog, how ribbon buttons open it and how you show a control of your own in it.

What the Sidebar Is

The Sidebar in the TXTextControl.Windows.Forms namespace is a container that gives quick access to a feature of a TextControl or to a control of your own. It is derived from System.Windows.Forms.TableLayoutPanel and is placed on a form like other containers, usually docked beside, above or below the editor. It is also in the TX Text Control 34.0 toolbox tab, and the smart tag of a TextControl adds sidebars at its sides.

Two properties decide what a sidebar shows: TextControl names the editor its panels work with, and ContentLayout selects the panel. Its default is None, which shows no content. In the designer, the smart tag of a sidebar sets both, and the sidebar shows the selected panel right away:

The Sidebar Tasks smart tag with the ContentLayout drop-down open, listing None, Custom, Goto, FieldNavigator, TrackedChanges, Styles, Find, Replace, ConditionalInstructions, DocumentSettings, Comments and About, next to a Styles sidebar.

The Predefined Panels

SidebarContentLayout has a value for each panel:

ValueShows
FindA search in the text
ReplaceA search that replaces the text found
GotoA Go To panel for moving through the document
StylesAll styles of the document
TrackedChangesAll tracked changes of the document
CommentsAll comments of the document, to show, select and edit them
FieldNavigatorThe merge fields of a template, to navigate through them
ConditionalInstructionsThe conditional instructions of a document, to manage them
DocumentSettingsThe document's settings, such as its title, author, subject, keywords, user-defined properties and embedded files
AboutA TextControl for information about your application
CustomA control of your own

FindItem returns a control inside a predefined panel, for example to hide an element your application does not need.

Docked or as a Dialog

A sidebar is either pinned into the form, where its layout follows the docking, or shown as a dialog, and users switch between the two with its pin button. IsShown shows or hides it. Sidebar and Panels describes the dialog styles, sizes and positions and the parts of the title bar.

Open Sidebars From the Ribbon

Several predefined ribbon tabs have properties that connect one of their buttons to a sidebar, such as the Find, Replace, Go To, Styles, Tracked Changes and Comments buttons. When the user clicks the button, the sidebar shows the matching panel, and one sidebar can serve several buttons. Open Sidebars With Ribbon Buttons lists the properties of each tab and shows how to set them in the designer and in code.

Show Your Own Control

With ContentLayout set to Custom, a sidebar shows any Windows Forms control that you assign to its Content property, with the same title bar and docking as a predefined panel. Show a Panel of Your Own shows the code.

Next Steps