DocumentTargetCollection Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WinForms. SDK
- Assembly
TXTextControl.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WinForms. SDK TXTextControl.from the setup.dll
- Implements
- ICollection, IEnumerable
Description
An instance of the DocumentTargetCollection class contains all targets in a Text Control document represented through objects of the type DocumentTarget. An instance of this class can only be obtained with the TextControl.DocumentTargets property. The DocumentTargetCollection class implements the IEnumerable and the ICollection interface. For more information see the technical article Text Fields and Hypertext Links.
Syntax
public sealed class DocumentTargetCollection : ICollection, IEnumerablePublic NotInheritable Class DocumentTargetCollection
Implements ICollection, IEnumerableExamples
The following example works with document targets in the current document.
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
DocumentTargetCollection documentTargetCollection = textControl.DocumentTargets;
documentTargetCollection.Add(new DocumentTarget("CustomerDetails") { ID = 100 });textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim documentTargetCollection As DocumentTargetCollection = textControl.DocumentTargets
documentTargetCollection.Add(New DocumentTarget("CustomerDetails") With { .ID = 100 })Members
Properties
| Property | Description |
|---|---|
| CanAdd | Gets a value indicating whether a new document target can be inserted at the current text input position. It is true if a target can be inserted, otherwise it is false. |
| Count | Gets the number of elements contained in the collection. |
| IsSynchronized | Returns true if the collection is designed to be thread safe, otherwise, it returns false. |
| Item | Gets the field with the specified number from the collection. The number must be between 1 and Count. In C# this property is the indexer for the DocumentTargetCollection class. |
| SyncRoot | Gets an object that can be used to synchronize access to the collection. |
Methods
| Method | Description |
|---|---|
| Add | Inserts the specified target at the current text input position. |
| Clear | Removes all document targets from a Text Control document. |
| CopyTo | Copies the elements of the collection to an array, starting at a particular index. |
| GetEnumerator | Returns an enumerator that can be used to iterate through the collection. |
| GetItem | Gets a particular document target from the collection. |
| GetItems | Gets all document targets at the current text input position. The method returns null, if there is no target at the current input position. |
| Remove | Removes the specified target from a Text Control document. |