TX Text Control .NET for WPF

Add Method

Method
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Inserts a new standard text field at the current input position.

Syntax

public bool Add(TextField textField);

Parameters

ParameterDescription
textField

Specifies the text field to add.

Return Value

The return value is true, if the text field could be added. Otherwise it is false.

Examples

The following example works with text fields in the current document by using TextFieldCollection.Add.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
TextFieldCollection textFieldCollection = textControl.TextFields;

if (!textFieldCollection.Add(new TextField()))
{
    throw new InvalidOperationException("The item could not be inserted.");
}