TX Text Control .NET for WPF

Add Method

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

Description

Adds a new editable region to the document. Its position is defined through the EditableRegion.Start and EditableRegion.Length properties. If the editable region's length is zero, the current text selection is used to define the position.

Syntax

public EditableRegionCollection.AddResult Add(EditableRegion editableRegion);

Parameters

ParameterDescription
editableRegion

Specifies the editable region to add.

Return Value

The return value specifies whether the new region has successfully been inserted. It can be one of the EditableRegionCollection.AddResult values.

Examples

The following example works with editable regions in the current document by using EditableRegionCollection.Add.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
EditableRegionCollection editableRegionCollection = textControl.EditableRegions;

var result = editableRegionCollection.Add(new EditableRegion("Editor", 100));
Console.WriteLine($"Add result: {result}");