TableOfContentsCollection Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WPF. SDK
- Assembly
TXTextControl.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WPF. SDK TXTextControl.from the setup.dll
- Implements
- ICollection, IEnumerable
Description
Contains all tables of contents in a certain part of the document. It is a collection of objects of the type TableOfContents. A collection object can be obtained with the TextControl.TablesOfContents, the WPF.TextControl.TablesOfContents, the HeaderFooter.TablesOfContents or the TextFrame.TablesOfContents property. The TableOfContentsCollection class implements the IEnumerable and the ICollection interfaces.
Syntax
public sealed class TableOfContentsCollection : ICollection, IEnumerablePublic NotInheritable Class TableOfContentsCollection
Implements ICollection, IEnumerableExamples
The following example works with tables of contents in the current document.
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
TableOfContentsCollection tableOfContentsCollection = textControl.TablesOfContents;
tableOfContentsCollection.Add(new TableOfContents(1, 3) { Name = "Contents", ID = 100 });textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim tableOfContentsCollection As TableOfContentsCollection = textControl.TablesOfContents
tableOfContentsCollection.Add(New TableOfContents(1, 3) With { .Name = "Contents", .ID = 100 })Members
Properties
| Property | Description |
|---|---|
| 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 table of contents with the specified number from the collection. The number must be between 1 and Count. In C# this property is the indexer for the TableOfContentsCollection class. |
| SyncRoot | Gets an object that can be used to synchronize access to the collection. |
Methods
| Method | Description |
|---|---|
| Add | Adds a new table of contents to the document at the current text input position. |
| 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 table of contents from the collection. |
| Remove | Removes a table of contents from the collection including all its text and including all DocumentTargets to where the table's links point. |
Enumerations
| Enumeration | Description |
|---|---|
| AddResult | Specifies the result when an existing table of contents has been updated or a new table of contents has been added to the document. |