# Document Editor

> Add editing features to the WPF TextControl in XAML and code-behind: Loaded, formatting, tables, barcodes, review, ribbon tabs connected by name, and events.

- **Product:** TX Text Control .NET for WPF
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET for WPF > Document Editor
- **1511 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/llms-full.txt

---

Which part of a word processor does your WPF window need next: tables, tracked changes, a protected form, a ribbon tab of your own? Each feature of the `TextControl` in a WPF application has a page here, with the XAML that declares it and the code-behind that drives it.

The pages build on the tutorials of [Document Editor](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/document-editor/llms-full.txt) in Getting Started, which declare the editor in *MainWindow.xaml*, connect a ribbon or rulers and add the file commands. Work through them first.

![A WPF window with the Home and Insert ribbon tabs of TX Text Control, a horizontal and a vertical ruler, an empty page and a status bar with the zoom slider.](https://docs.textcontrol.com/assets/img/tx-text-control-dotnet-wpf/ribbon-home-insert-tabs.5d2ec2a5.webp)

### How the WPF Editor Works

- **An element of the XAML.** [TextControl](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/llms-full.txt) of the `TXTextControl.WPF` namespace is a WPF control, declared in the window as `<WPF:TextControl x:Name="textControl1" />`. Its document consists of the main text, text frames, headers, footers and footnotes.
- **Ready after Loaded.** The control exists after `InitializeComponent`, but code that works with the document belongs in its `Loaded` event.
- **A shared object model.** `Selection` and collections such as `Tables` belong to the `TXTextControl` namespace and work the same way in [ServerTextControl](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/servertextcontrol/llms-full.txt), which [Document Processing](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-processing/llms-full.txt) uses without a user interface.
- **Connections by name.** Rulers, the status bar, the button bar and ribbon tabs such as [RibbonFormattingTab](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/ribbonformattingtab/llms-full.txt) are separate elements. The ribbon tabs go inside the `Ribbon` of Microsoft's `System.Windows.Controls.Ribbon`, and the `TextControl` finds each element through a string property that holds its `x:Name`.
- **No charts.** Chart frames are a feature of the Windows Forms product; the WPF editor supports barcodes.

### Find the Right Page

| If you want to | Read |
|---|---|
| Know where startup code goes and how the document is organized | [Architecture and Control Lifecycle](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/architecture/llms-full.txt) |
| Work with the selection, the clipboard, undo or search | [Editing Text](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/editing-text/llms-full.txt) |
| Format text, apply styles or create lists | [Text and Paragraph Formatting](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/formatting/llms-full.txt) |
| Add tables, images, frames or barcodes | [Tables and Table Formulas](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/tables/llms-full.txt) and the pages after it |
| Review documents with several people | [Track Changes](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/track-changes/llms-full.txt), [Comments](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/comments/llms-full.txt) |
| Declare ribbon tabs, bars and sidebars in XAML | [Ribbon and UI](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/ribbon-ui/llms-full.txt) |
| Handle routed events and the events of the editor | [Events](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/events/llms-full.txt) |

### Where to Start

1. Build a window with [Create Your First WPF Application](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/document-editor/first-application/llms-full.txt), then read [Add TextControl in XAML](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/document-editor/xaml/llms-full.txt).
2. Add a ribbon with [Create a WPF Ribbon Application](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/document-editor/ribbon/llms-full.txt) if your users expect one.
3. Read [Architecture and Control Lifecycle](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/architecture/llms-full.txt) before you write code that changes the document.
4. Continue with the page of your feature, and compare with the [TX Words Sample Application](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/examples/tx-words/llms-full.txt).

### Pages in This Section

- [Architecture and Control Lifecycle](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/architecture/llms-full.txt) — text parts and the `Loaded` event.
- [Loading and Saving Documents](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/load-save/llms-full.txt) — databases, HTML strings and load errors.
- [Document Properties](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/properties/llms-full.txt) — title, author, keywords and custom properties.
- [Editing Text](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/editing-text/llms-full.txt) — selections, clipboard, undo, search and keys.
- [Text and Paragraph Formatting](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/formatting/llms-full.txt) — fonts, alignment and tab stops.
- [Stylesheets](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/stylesheets/llms-full.txt) — the styles gallery and code.
- [Bullets and Numbered Lists](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/lists/llms-full.txt) — list formats and numbering.
- [Tables and Table Formulas](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/tables/llms-full.txt) — tables and cell formulas.
- [Images](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/images/llms-full.txt) — images and the text flow.
- [Text Frames and Shapes](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/text-frames-shapes/llms-full.txt) — text frames and drawings.
- [Charts and Barcodes](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/charts-barcodes/llms-full.txt) — barcodes; WPF has no charts.
- [Headers and Footers](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/headers-footers/llms-full.txt) — headers, footers and page numbers.
- [Sections and Page Layout](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/sections/llms-full.txt) — page formats and section breaks.
- [Footnotes](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/footnotes/llms-full.txt) — the `Footnotes` collection.
- [Tables of Contents](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/tables-of-contents/llms-full.txt) — generated from structure levels.
- [Fields, Hyperlinks, and Bookmarks](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/fields/llms-full.txt) — text fields and links.
- [Subtext Parts](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/subtext-parts/llms-full.txt) — named ranges of text.
- [Form Fields and Conditional Instructions](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/form-fields/llms-full.txt) — forms and validation.
- [Signature Fields](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/signature-fields/llms-full.txt) — places for signatures.
- [Track Changes](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/track-changes/llms-full.txt) — accepting and rejecting changes.
- [Comments](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/comments/llms-full.txt) — comments and replies.
- [Document Protection and Editable Regions](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/protection/llms-full.txt) — read-only documents and open regions.
- [Spell Checking and Hyphenation](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/spell-checking/llms-full.txt) — connecting TX Spell .NET for WPF.
- [Viewing, Zooming, and Navigation](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/viewing/llms-full.txt) — view modes and zoom bindings.
- [Printing and Print Preview](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/printing/llms-full.txt) — page ranges and the WPF `PrintDialog`.
- [Ribbon and UI](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/ribbon-ui/llms-full.txt) — the elements around the editor.
- [Events](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/events/llms-full.txt) — routed events and editor events.

---

## In This Section

- [Architecture and Control Lifecycle](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/architecture/llms-full.txt): The WPF TextControl in a window: bars connected by name, text parts and the input focus, startup code in Loaded, FormattingPrinter and ServerTextControl.
- [Charts and Barcodes](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/charts-barcodes/llms-full.txt): Insert QR codes and barcodes in a WPF TextControl with the WPF TXBarcodeControl and BarcodeFrame, format them on the ribbon; charts are Windows Forms only.
- [Comments](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/comments/llms-full.txt): Work with MS Word compatible comments in a WPF TextControl: add comments and replies in code, list and remove them, set CommentHighlightMode and handle events.
- [Editing Text](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/editing-text/llms-full.txt): Editing text in the WPF TextControl: selections, clipboard, undo, find and replace, dropped files and keys, with XAML and code-behind for your own commands.
- [Events](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/events/llms-full.txt): Connect TextControl events in XAML or code, see how they differ from routed events, track unsaved changes and find every WPF TextControl event by subject.
- [Fields, Hyperlinks, and Bookmarks](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/fields/llms-full.txt): Insert text fields, change MS Word fields and form fields, format and edit hyperlinks, manage bookmarks and open linked files in a WPF TextControl.
- [Footnotes](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/footnotes/llms-full.txt): Add footnotes to documents in a WPF TextControl: connect the RibbonReferencesTab in XAML, insert and number footnotes in C#, navigate, remove and handle events.
- [Form Fields and Conditional Instructions](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/form-fields/llms-full.txt): Create WPF forms with the RibbonFormFieldsTab or C#: text, check box, drop-down and date fields, form protection, field values and conditional instructions.
- [Text and Paragraph Formatting](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/formatting/llms-full.txt): Set fonts, colors, alignment, indents and tab stops in the WPF TextControl with Selection and ParagraphFormat, and open the built-in formatting dialog boxes.
- [Headers and Footers](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/headers-footers/llms-full.txt): Set header activation and frame style in XAML, add footers with page numbers and open headers for editing from code in a WPF TextControl with HeaderFooter.
- [Images](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/images/llms-full.txt): Insert images in a WPF TextControl from files or memory, set text flow, position and z-order, and control image formats and file names when saving.
- [Bullets and Numbered Lists](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/lists/llms-full.txt): Build bulleted, numbered and multilevel lists in a WPF editor with ListFormat, restart numbering with list styles and read list numbers of paragraphs in code.
- [Loading and Saving Documents](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/load-save/llms-full.txt): Open and save documents in the WPF TextControl with the built-in dialog boxes: WPF.DialogResult, file filters, DialogSettings, byte arrays and HTML strings.
- [Printing and Print Preview](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/printing/llms-full.txt): Print from a WPF TextControl with the Print overloads, PageRange and Collation, connect the WPF PrintDialog and set the FormattingPrinter for exact line breaks.
- [Document Properties](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/properties/llms-full.txt): Get and set the title, author, keywords and user-defined properties of a WPF document with DocumentSettings, a XAML sidebar panel and SaveSettings.
- [Document Protection and Editable Regions](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/protection/llms-full.txt): Restrict editing in a WPF TextControl: EditMode, DocumentPermissions and passwords, editable regions for single users, the Permissions tab and CanPrint checks.
- [Ribbon and UI](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/ribbon-ui/llms-full.txt): Declare the WPF UI around TextControl in XAML: TX Text Control ribbon tabs in a WPF Ribbon, ButtonBar, mini toolbars, RulerBar, StatusBar, Sidebar and dialogs.
- [Sections and Page Layout](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/sections/llms-full.txt): Divide WPF documents into sections with landscape pages, margins and columns: SectionCollection.Add, SectionFormat, SectionChanged in XAML, 1/96 inch units.
- [Signature Fields](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/signature-fields/llms-full.txt): Add signature fields in WPF: connect the Insert and frame layout ribbon tabs in XAML, insert SignatureField objects in C# and set signer data and images.
- [Spell Checking and Hyphenation](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/spell-checking/llms-full.txt): Spell checking in a WPF TextControl: declare a TXSpellChecker resource in XAML, plug in your own checker with SpellCheckText and adjust HyphenateWord.
- [Stylesheets](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/stylesheets/llms-full.txt): Define ParagraphStyle and InlineStyle styles in a WPF editor, apply them, update them with Apply, show the Styles sidebar in XAML and copy template styles.
- [Subtext Parts](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/subtext-parts/llms-full.txt): Use SubTextPart in a WPF TextControl to name text ranges such as contract clauses, attach JSON data, highlight, save and remove them and handle their events.
- [Tables of Contents](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/tables-of-contents/llms-full.txt): Build tables of contents in a WPF TextControl from structure levels and paragraph styles with the RibbonReferencesTab, TableOfContentsDialog or TableOfContents.
- [Tables and Table Formulas](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/tables/llms-full.txt): Build tables in a WPF TextControl with the ribbon or TableCollection: add rows, open Table Properties, calculate cells with formulas, A1 and R1C1 references.
- [Text Frames and Shapes](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/text-frames-shapes/llms-full.txt): Insert text frames and drawings in a WPF TextControl with the mouse or in code, bind marker lines in XAML and create shapes with the WPF TXDrawingControl.
- [Track Changes](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/track-changes/llms-full.txt): Turn on track changes in a WPF TextControl in XAML or code, accept or reject tracked changes, handle CannotTrackChange and connect the Tracked Changes sidebar.
- [Viewing, Zooming, and Navigation](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/viewing/llms-full.txt): Choose a ViewMode, bind or set ZoomFactor, show control characters and markers, and move to a page with InputPosition and GotoDialog in a WPF TextControl.

---

## Nearby

- **Previous:** [Digitally Sign a PDF](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/getting-started/pdf/sign/llms-full.txt)
- **Next:** [Architecture and Control Lifecycle](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/document-editor/architecture/llms-full.txt)
