TX Text Control .NET for WPF

EditableRegionCollection Class

Class|Introduced in 25.0
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.
Implements
ICollection, IEnumerable

Description

Contains all editable regions in the main text or another part of a document. It is a collection of objects of the type EditableRegion. A collection object can be obtained with the TextControl.EditableRegions, the HeaderFooter.EditableRegions or the TextFrame.EditableRegions property. The EditableRegionCollection class implements the IEnumerable and the ICollection interfaces. When the EditMode property of a Text Control has been set to ReadAndSelect, editable regions can still be edited, either by everyone or depending on the UserName property by a certain user.

Syntax

public sealed class EditableRegionCollection : ICollection, IEnumerable

Examples

The following example works with editable regions in the current document.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
EditableRegionCollection editableRegionCollection = textControl.EditableRegions;
editableRegionCollection.Add(new EditableRegion("ReviewTeam", 100));

Members

Properties

PropertyDescription
CountGets the number of elements contained in the collection.
IsSynchronizedReturns true if the collection is designed to be thread safe, otherwise, it returns false.
ItemGets the editable region with the specified number from the collection. The number must be between 1 and Count. In C# this property is the indexer for the EditableRegionCollection class.
SyncRootGets an object that can be used to synchronize access to the collection.

Methods

MethodDescription
AddAdds 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.
CopyToCopies the elements of the collection to an array, starting at a particular index.
GetEnumeratorReturns an enumerator that can be used to iterate through the collection.
GetItemGets the editable region with the specified id. The method returns null, if such a region does not exist. If more than one region with this id exists, the first found region is returned.
GetItemsGets all editable regions at the current text input position. The method returns null, if there is no region at the current input position.
RemoveRemoves an editable region from the collection. The region's text is not removed.

Enumerations

EnumerationDescription
AddResultSpecifies the result when an editable region has been added to the document.