TX Text Control .NET for WPF

Clear Method

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

Description

Removes all document links from a Text Control document.

Syntax

public void Clear(bool keepText);

Parameters

ParameterDescription
keepText

If this parameter is set to true, all document links are removed without deleting their texts. Otherwise, the texts are also deleted.

Examples

The following example works with document links in the current document by using DocumentLinkCollection.Clear.

textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
DocumentLinkCollection documentLinkCollection = textControl.DocumentLinks;
DocumentTarget target = new("CustomerDetails");
textControl.DocumentTargets.Add(target);
documentLinkCollection.Add(new DocumentLink("View customer details", target) { ID = 100 });

if (documentLinkCollection.Count > 0)
{
    documentLinkCollection.Clear(true);
}