TX Text Control .NET for WPF

TextField Class

Class
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.dll
Install
dotnet add package TXTextControl.TextControl.WPF.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.
Derived
ApplicationField, DocumentLink, FormField, HypertextLink, PageNumberField

Description

An instance of the TextField class represents a text field in a Text Control document. A text field is a marked piece of text that has properties like text or a name. The TextControl class has several events that inform about different occurrences. For more information see the technical article Text Fields and Hypertext Links.

Syntax

public class TextField

Examples

The following example shows how to insert and populate a text field.

TXTextControl.TextField field = new TXTextControl.TextField("Product");
field.Name = "product";
textControl1.TextFields.Add(field);

foreach (TXTextControl.TextField curfield in textControl1.TextFields)
{
    if (curfield.Name == "product")
        curfield.Text = "TX Text Control";
}

The following example inserts a Word-compatible text field into a template.

TextField textField = new ApplicationField(ApplicationFieldFormat.MSWord, "MERGEFIELD", "Customer name", new[] { "CustomerName" });
textControl.TextFields.Add(textField);

Members

Constructors

ConstructorDescription
TextFieldCreates a new instance of the TextField class.

Properties

PropertyDescription
BoundsGets the bounding rectangle of a text field. The bounding rectangle is the smallest rectangle which contains all characters of the field's text. The rectangle is given in twips with an origin at the upper left corner of the document.
ContainsInputPositionReturns true, if the Textfield contains the current text input position.
DeleteableSpecifies whether a text field can be deleted by the end-user while a TX Text Control document is being edited. The default setting of this property is true.
DoubleClickEventSpecifies whether a TextControl.TextFieldDoubleClicked event is raised, if the end-user doubleclicks the text field. If an event is raised, the normal double-click processing, which selects a single word in the text is suppressed. The default setting of this property is true.
DoubledInputPositionSpecifies whether a text field has a doubled input position in front of its first character and behind its last character. This enables an end-user to decide whether inserted text at these positions will belong to the text field or not. The default setting of this property is false. For all form fields to work properly this property is set to true and cannot be changed to false.
EditableSpecifies whether the text of a text field can be changed by the end-user while a TX Text Control document is being edited. The default setting of this property is true.
FormattingBoundsGets the formatting rectangle of a text field. The formatting rectangle is the largest rectangle to which the area covered by the field can grow. The rectangle is given in twips with an origin at the upper left corner of the document.
HighlightColorGets or sets the highlight color for the text field. The color's alpha value must be less than 255 (opaque) so that the text field's text remains visible. The default value is black with an alpha value of 60 (light gray).
HighlightModeGets or sets a value indicating when the text field is highlighted.
IDGets or sets an identifier for a text field. This identifier can be used to uniquely identify a text field.
IsSpellCheckingEnabledSpecifies whether a text field's text is checked on misspelled words. The default setting of this property is true.
LengthGets the number of characters in a text field.
NameRelates a user-defined name to a text field. This can be any kind of text. This name can be used to uniquely identify a text field.
ShowActivatedObsolete. Specifies whether a text field toggles its background to gray, if the current input position is in the field. The default setting of this property is false. This property is obsolete and has been superseded by the HighlightColor and HighlightMode properties.
StartGets the first character position (one-based) of a text field.
TextReturns or sets the text which is contained within a text field. This property is not supported for the DocumentTarget class.

Methods

MethodDescription
ScrollToSets the current input position to the beginning of a text field and scrolls it into the visible part of the document.