TX Text Control .NET for WPF

Document Editor Examples

Topic

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

ExampleWhat it showsWhere
Print previewA 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 numbersLine 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 guidesVertical 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 fieldsA 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:

ExampleWhat it showsWhere
SimpleThe smallest word processor: loading and saving, the clipboard, formatting dialog boxes, two RulerBar controls, a ButtonBar and a StatusBarTXSamples_WPF_CSharp, folder Tutorial
HyperlinksHypertext links and link targets in three steps, and the events of a clicked linkTXSamples_WPF_CSharp, folder Howto
Mini toolbarGroups of the MiniToolbar that depend on what is selected; ShowMiniToolbar switches it onTXSamples_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:

ExampleWhat it showsWhere
Insert image dialogA dialog box of your own for inserting images, with the file filters of the supported image formatsCustom Insert Image Dialog in TX Text Control .NET for WPF

Next Steps