TX Text Control .NET for WPF

What's New in TX Text Control .NET for WPF 16.0

Topic

TX Text Control .NET for WPF begins with version 16.0, which added four WPF controls to the class library of TX Text Control. The same version opened the text of a document to a common interface, so that the main text, text frames and headers and footers became text parts with the same members, and it added a spell checker interface, table headers that repeat on every page and nested merge blocks.

Version 16.0 was released in November 2010, as the blog article TX Text Control 16.0 Has Just Been Released announced. It was the first version with a WPF edition, TX Text Control .NET for WPF, whose installer in the download package is TX Text Control.NET for WPF 16.0.exe; together with the server components, it was also sold as TX Text Control Server for ASP.NET (incl. WPF). Windows Forms features of the version, such as Windows Forms controls in browser applications, aren't listed here; their breaking changes are, because they affect the shared assemblies.

Version 16.0 at a Glance

AreaWhat is new
WPF controlsWPF.TextControl, WPF.ButtonBar, WPF.RulerBar and WPF.StatusBar for WPF applications and WPF browser applications
Data bindingThe InputFormat class for ribbons and value converters for XAML
Text partsTextPartCollection, the IFormattedText interface and the MainText class
Spell checkingAn interface for any spell checker, with the SpellCheckText event
TablesHeader rows that repeat on each page
Mail mergeNested merge blocks, image merge fields, access to the merged data
FormattingIndents and font sizes changed in steps
Page sizeThe PageSize class and a unit for page sizes and margins

WPF Controls

The new TXTextControl.WPF namespace holds four controls for WPF applications (.exe) and WPF browser applications (.xbap). They offer the feature set of the Windows Forms controls:

WPF.TextControl and Ribbon Tabs, Toolbars, Rulers, and Status Bar describe these controls today.

Ribbons and Data Binding

  • Input format. The InputFormat class has a property for each character and paragraph attribute at the input position, which is updated whenever the input position changes. WPF.TextControl.InputFormat returns it, so that the controls of a ribbon can bind to it in XAML without code behind.
  • Value converters. Four converters adapt values for bindings: WPF.BooleanConverter converts a value to a Boolean, WPF.ColorConverter converts System.Drawing.Color to System.Windows.Media.Color, WPF.MeasureConverter converts twips to another unit, and WPF.LogarithmicConverter maps a value from a linear to a logarithmic scale.

Data Binding shows how bindings to the TextControl work in the current version.

Text Parts

A document consists of its main text and further pieces of text: text frames and headers and footers.

  • All text parts. WPF.TextControl.TextParts and ServerTextControl.TextParts return a TextPartCollection with all text parts of the document in geometric order: first the main text, then the text frames, then the headers and footers. Activate moves the input position into a text part, and GetItem returns the active one.
  • One interface. Every text part implements IFormattedText, which provides its lines, paragraphs, characters, selection, tables, images, text fields, hypertext links, application fields and misspelled words, and a Find method. WPF.TextControl, ServerTextControl, TextFrame, HeaderFooter and MainText implement it.
  • Main text. A MainText object stands for the main text. Its collections always belong to the main text, while the collections of the control belong to the text part that has the input focus.

Subtext Parts covers text parts and subtext parts in the current version.

Spell Checking

TX Text Control got an interface that connects any spell checker:

Spell Checking and Hyphenation covers spell checking in the current version.

Tables, Formatting and Pages

Mail Merge

Upgrade to Version 16.0

Version 16.0 changed types and assemblies of the class library that TX Text Control .NET for WPF shares with the Windows Forms edition. Code written for earlier versions has to be adapted:

  • Page margins. The properties Left, Top, Right and Bottom of PageMargins are of the type double instead of int.
  • Page size. ServerTextControl.PageSize, and PageSize of the Windows Forms TextControl, are of the type PageSize instead of System.Drawing.Size.
  • Dialog results. The overloads of Selection.Load that open a dialog box return a Selection.DialogResult value instead of System.Windows.Forms.DialogResult.
  • Browser controls removed. The classes BrowserTextControl, BrowserButtonBar, BrowserRulerBar and BrowserStatusBar were removed. Replace them with TextControl, ButtonBar, RulerBar and StatusBar.
  • Assemblies. TXTextControl.dll was split into TXTextControl.dll and TXTextControl.Windows.Forms.dll.

New Classes, Properties, Methods and Events

The classes and members below are the ones that the What's New documentation of version 16.0 lists for TX Text Control .NET for WPF. Names are relative to the TXTextControl namespace, each name links to its current reference page, and "(obsolete)" marks a member that is obsolete today.

New Classes

Members by Class

ClassPropertiesMethodsEvents
DocumentServer.MailMergeRemoveTrailingWhitespaceGetBlockNamesImageFieldMerged
DocumentServer.MailMerge.DataRowMergedEventArgsMergedRow
DocumentServer.MailMerge.FieldMergedEventArgsMergedField
DocumentServer.MailMerge.ImageFieldMergedEventArgsFieldName, Filename, Image, Merged
HeaderFooterHypertextLinks, MisspelledWordsFind
IFormattedTextApplicationFields, HypertextLinks, Images, Lines, MisspelledWords, Paragraphs, Selection, Tables, TextChars, TextFieldsFind
InputFormatAllFrameLines, Bold, BottomDistance, BottomFrameLine, BoxFrame, BulletCharacter, BulletedList, Centered, FontFamily, FontSize, HangingIndent, InnerHorizontalFrameLines, InnerVerticalFrameLines, Italic, Justified, LeftAligned, LeftFrameLine, LeftIndent, LineSpacing, NumberedList, NumberedListFormat, NumberFormats, RightAligned, RightFrameLine, RightIndent, Strikeout, StructuredList, StructuredListFormat, StyleName, StyleNames, Subscript, Superscript, TextBackColor, TextColor, TopDistance, TopFrameLine, Underline, UnderlineStyle, UnderlineStylesGetFontFamilies, GetFontSizes
MisspelledWordLength, Number, Start, TextSelect
MisspelledWordCollectionCount, ItemCopyTo, GetEnumerator, GetItem, Remove
PageSizeHeight, Width
SelectionDecreaseIndent, GrowFont, IncreaseIndent, ShrinkFont
ServerTextControlIsSpellCheckingEnabled, MisspelledWords, PageUnit, TextPartsOnSpellCheckTextSpellCheckText
SpellCheckTextEventArgsMisspelledWords, Text
TableRowIsHeader
TextFieldIsSpellCheckingEnabled
TextFrameHypertextLinks, MisspelledWords
TextPartCollectionCountActivate, CopyTo, GetEnumerator, GetItem, GetMainText
WPF.BooleanConverterConvert, ConvertBack
WPF.ColorConverterConvert, ConvertBack
WPF.LogarithmicConverterInputCenter, InputMaximum, InputMinimum, OutputMaximum, OutputMinimumConvert, ConvertBack
WPF.MeasureConverterDecimals, ShowAllDecimals, UnitConvert, ConvertBack
WPF.RulerBarBorderStyle, DisplayColors, EnablePageMargins, ScaleUnit
WPF.RulerBar.ColorsBackColor, ForeColor, GradientBackColor, RulerColor, SeparatorColorDark, SeparatorColorLight
WPF.StatusBarBorderStyle, ColumnText, DisplayColors, FontFamily, FontSize, FontStyle, FontWeight, LineText, PageCounterText, PageText, SectionCounterText, SectionText, ShowColumn, ShowKeyStates, ShowLine, ShowPage, ShowPageCounter, ShowSection, ShowSectionCounter, ShowZoom, Text
WPF.StatusBarColorsBackColor, ForeColor, FrameColor, GradientBackColor
WPF.TextControlAcceptsTab, AllowDrag, AllowDrop, ApplicationFields, AutoControlSize, Baseline, BorderThickness, ButtonBar, CanCopy, CanPaste, CanRedo, CanUndo, CaretWidth, ControlChars, DisplayColors, DocumentLinks, DocumentTargetMarkers, DocumentTargets, DropFormats, EditMode, FieldCursor, FontFamily, FontSettings, FontSize, FontStyle, FontUnderlineStyle, FontWeight, FormattingPrinter, HeaderFooterActivationStyle, HeaderFooterFrameStyle, HeadersAndFooters, HideSelection, HorizontalScrollBarVisibility, HypertextLinks, Images, InlineStyles, InputFormat, InputPosition, InsertionMode, IsSpellCheckingEnabled, IsTabStop, IsUndoEnabled, Landscape, Lines, ListFormat, MisspelledWords, PageMargins, Pages, PageSize, PageUnit, ParagraphFormat, Paragraphs, ParagraphStyles, RedoActionName, RulerBar, ScrollLocation, Sections, Selection, StatusBar, TabIndex, Tables, Text, TextChars, TextFields, TextFrameMarkerLines, TextFrames, TextParts, UndoActionName, VerticalRulerBar, VerticalScrollBarVisibility, ViewMode, XmlEditMode, ZoomFactorAppend, Clear, ClearUndo, Copy, Cut, Find, FontDialog, FormattingStylesDialog, GetClipboardFormats, GetPages, GetXmlElements, ImageAttributesDialog, ListFormatDialog, Load, OnAdaptFont, OnChanged, OnCharFormatChanged, OnDocumentLinkClicked, OnFormattingStyleListChanged, OnHeaderFooterActivated, OnHeaderFooterDeactivated, OnHExpanded, OnHScroll, OnHShrunk, OnHypertextLinkClicked, OnImageClicked, OnImageCreated, OnImageDeleted, OnImageDoubleClicked, OnImageMoved, OnImageRightClicked, OnImageSized, OnInputFormattingStyleChanged, OnInputParagraphChanged, OnInputPositionChanged, OnPageChanged, OnPageFormatChanged, OnParagraphFormatChanged, OnSectionChanged, OnSpellCheckText, OnTableCreated, OnTableDeleted, OnTableFormatChanged, OnTextFieldChanged, OnTextFieldClicked, OnTextFieldCreated, OnTextFieldDeleted, OnTextFieldDoubleClicked, OnTextFieldEntered, OnTextFieldLeft, OnTextFrameActivated, OnTextFrameClicked, OnTextFrameCreated, OnTextFrameDeactivated, OnTextFrameDeleted, OnTextFrameDoubleClicked, OnTextFrameMoved, OnTextFrameRightClicked, OnTextFrameSized, OnVExpanded, OnVScroll, OnVShrunk, OnXmlInvalid, OnXmlNotWellFormed, ParagraphFormatDialog, Paste, Print, Redo, Replace, ResetContents, Save, SectionFormatDialog, Select, SelectAll, TabDialog, TableFormatDialog, UndoAdaptFont, Changed, CharFormatChanged, DocumentLinkClicked, FormattingStyleListChanged, HeaderFooterActivated, HeaderFooterDeactivated, HExpanded, HScroll, HShrunk, HypertextLinkClicked, ImageClicked, ImageCreated, ImageDeleted, ImageDoubleClicked, ImageMoved, ImageRightClicked, ImageSized, InputFormattingStyleChanged, InputParagraphChanged, InputPositionChanged, PageChanged, PageFormatChanged, ParagraphFormatChanged, SectionChanged, SpellCheckText, TableCreated, TableDeleted, TableFormatChanged, TextFieldChanged, TextFieldClicked, TextFieldCreated, TextFieldDeleted, TextFieldDoubleClicked, TextFieldEntered, TextFieldLeft, TextFrameActivated, TextFrameClicked, TextFrameCreated, TextFrameDeactivated, TextFrameDeleted, TextFrameDoubleClicked, TextFrameMoved, TextFrameRightClicked, TextFrameSized, VExpanded, VScroll, VShrunk, XmlInvalid, XmlNotWellFormed
WPF.TextControlColorsDarkShadowColor, DesktopColor, LightShadowColor, PageBackColor, TextBackColor, TextColor

Next Steps

  • Version 17.0: the features of the next version.
  • Version 15.1: the frame base class and document-wide image export, before the WPF edition.
  • Data Binding: bind WPF elements to the TextControl.