Document Editor Examples
These samples extend the editing window of TX Text Control .NET for WPF: a print preview, guides and line numbers drawn over the document, a date picker for fields, hyperlinks and the mini toolbar. Each one is a small project that shows one technique around the TextControl, and the tables name the version and the framework it was written for.
Before You Run an Older Sample
Most of these samples target the .NET Framework and reference the assemblies of an earlier version of TX Text Control. Reference the assemblies of your installation and update the version in licenses.licx, as GitHub Examples describes. Samples for .NET 6 need the target framework .NET 8 or higher and the current package.
Single Samples
| Example | What it shows | Where |
|---|---|---|
| Print preview | A print preview that WPF lacks: each page is rendered with Page.GetImage and shown in the WPF DocumentViewer, as described in New Sample: Building a Print Preview for TX Text Control .NET for WPF. .NET Framework 4.8, version 33.0, C# | TextControl.WPF.PrintPreview |
| Line numbers | Line numbers next to each line of text, placed over the editor with PointFromDocument and the Lines collection, as described in Displaying Line Numbers in Windows Forms and WPF. .NET Framework 4.8, version 33.0, C# | TextControl.WPF.LineNumbering |
| Tab stop guides | Vertical guides from the ruler down the page at the tab positions of the current paragraph, updated in ParagraphFormatChanged. .NET Framework 4.5, version 33.0, C# | TextControl.WPF.TabStopGuides |
| Date picker for date fields | A WPF DatePicker that opens when the user clicks a date field, in the TextFieldClicked event, and writes the date through DateField. .NET Framework 4.5, version 22.0, C# | TextControl.WPF.DatePicker |
Official Samples
The how-to and tutorial samples of TXSamples_WPF_CSharp and TXSamples_WPF_VB.NET are written for version 32.0, for the .NET Framework 4.8 and .NET 6:
| Example | What it shows | Where |
|---|---|---|
| Simple | The smallest word processor: loading and saving, the clipboard, formatting dialog boxes, two RulerBar controls, a ButtonBar and a StatusBar | TXSamples_WPF_CSharp, folder Tutorial |
| Hyperlinks | Hypertext links and link targets in three steps, and the events of a clicked link | TXSamples_WPF_CSharp, folder Howto |
| Mini toolbar | Groups of the MiniToolbar that depend on what is selected; ShowMiniToolbar switches it on | TXSamples_WPF_CSharp, folder Howto |
The how-to samples for spreadsheet formulas and XML files are listed in Document Processing Examples. The TX Words samples show context menus, keyboard shortcuts, drag and drop, hyperlinks, right-to-left text and editable regions for each user; see TX Words WPF Sample Application.
Blog Articles With Code
These articles contain their complete code, without a repository:
| Example | What it shows | Where |
|---|---|---|
| Insert image dialog | A dialog box of your own for inserting images, with the file filters of the supported image formats | Custom Insert Image Dialog in TX Text Control .NET for WPF |
Next Steps
- Ribbon and Sidebar Examples: samples of the ribbon tabs and the sidebars.
- Printing and Print Preview: print documents from the editor.
- GitHub Examples: run a sample and update it to the current version.