TX Text Control .NET for WPF

Product Architecture

Topic

Knowing how the parts of TX Text Control .NET for WPF connect tells you what to declare in XAML, what to set in code and which files your application ships. At the center of every window is a TextControl; ribbon tabs, bars and sidebars are separate elements that refer to it by name; ServerTextControl and MailMerge work in code; and one document engine does the work for all of them.

Architecture at a Glance

The parts fall into three layers:

  • The editor and its user interface. TextControl displays and edits the document. The ribbon tabs, the button bar, the ruler bars, the status bar and the sidebar are WPF controls of their own that show and change the state of the editor they are connected to.
  • The classes without a user interface. ServerTextControl processes documents in code, and MailMerge merges data into templates, in the editor or on their own.
  • The document engine. .NET assemblies and native Windows libraries load, format, render, print and save the documents for all of them.

A typical window arranges the controls in a DockPanel, with the editor as the last child so that it fills the remaining space:

Window (DockPanel)
+--------------------------------------------------------------+
| Ribbon (Microsoft) hosting RibbonFormattingTab, ...          |
+---------+------------------------------------+---------------+
|         | RulerBar                           |               |
| Vertical|------------------------------------|   Sidebar     |
| RulerBar| TextControl                        |               |
|         |                                    |               |
+---------+------------------------------------+---------------+
| StatusBar                                                    |
+--------------------------------------------------------------+

TextControl.RulerBar = "rulerBar1"   (connections are names)
MailMerge.TextComponent --> TextControl or ServerTextControl

TX Text Control engine: .NET assemblies + native libraries (win-x64, win-x86)

How the Editor Finds Its Bars

TextControl, ButtonBar, RulerBar, StatusBar, Sidebar and the ribbon tabs are WPF controls of their own, and a bar does nothing until the editor names it. The connecting properties, such as RulerBar of the TextControl, are strings that hold the Name of an element in the same window, so the connections are written in XAML. A sidebar points the other way and names its editor, and a ribbon tab names the sidebars its buttons open. Connections Are Names lists every connecting property with a complete window.

TX Text Control provides the twelve ribbon tabs, not the ribbon itself: the tabs are placed in the Ribbon of Microsoft's System.Windows.Controls.Ribbon assembly. Ribbon Tabs, Toolbars, Rulers, and Status Bar and Sidebar introduce the controls around the editor.

ServerTextControl and MailMerge

  • ServerTextControl is a System.ComponentModel.Component, not a WPF element. It has the document interface of TextControl without anything on screen, and your code creates it, initializes it with Create and disposes it.
  • MailMerge merges data into templates. It is connected through its TextComponent property, this time with an object, not a name: to the editor, which then shows the merged result, or to a ServerTextControl, which creates documents in the background.

The Document Engine

All parts use the same engine, made of .NET assemblies and native Windows libraries. TXTextControl.WPF.dll contains the WPF controls, and the other assemblies hold the document model, ServerTextControl, mail merge, barcodes, drawings, PDF and images; Assemblies and XAML Namespaces lists them. The native libraries format and render the documents and read and write the file formats. They exist for 32-bit and for 64-bit processes, and each process loads the set of its own bitness, as 32-bit and 64-bit Applications explains. Managed Assemblies and Native Libraries lists what your application deploys.

The engine formats the document with the text dimensions of a printer, so that the screen and the printout match; Formatting With a Printer explains the setting. The editor also brings its own dialog boxes, described in Built-in Dialog Boxes, and prints through WPF printing, as Printing and Print Preview shows.

Next Steps