TX Text Control .NET for WPF

Document Editor

Topic

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 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.

How the WPF Editor Works

  • An element of the XAML. TextControl 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, which Document Processing uses without a user interface.
  • Connections by name. Rulers, the status bar, the button bar and ribbon tabs such as RibbonFormattingTab 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 toRead
Know where startup code goes and how the document is organizedArchitecture and Control Lifecycle
Work with the selection, the clipboard, undo or searchEditing Text
Format text, apply styles or create listsText and Paragraph Formatting
Add tables, images, frames or barcodesTables and Table Formulas and the pages after it
Review documents with several peopleTrack Changes, Comments
Declare ribbon tabs, bars and sidebars in XAMLRibbon and UI
Handle routed events and the events of the editorEvents

Where to Start

  1. Build a window with Create Your First WPF Application, then read Add TextControl in XAML.
  2. Add a ribbon with Create a WPF Ribbon Application if your users expect one.
  3. Read Architecture and Control Lifecycle before you write code that changes the document.
  4. Continue with the page of your feature, and compare with the TX Words Sample Application.

Pages in This Section