Tracked Changes: Toggle Markup
Tracked changes is also known as red-lining - a way to track changes done by users to a document. Displaying the changes in various colors can be distracting. This demo code shows how to turn the rendering of the markup on and off.

Tracked changes is also known as red-lining - a way to track changes done by users to a document. Displaying these changes in various colors can be distracting. This sample code shows how to turn the rendering of the markup on and off.

The following code uses a variable _isMarkupVisible that defines whether the markup should be rendered or not. In the Changed event, the ToggleMarkup method is called.
private bool _isMarkupVisible = true;
private void btnToggleMarkup_Click(object sender, EventArgs e) {
_isMarkupVisible = !_isMarkupVisible;
ToggleMarkup();
}
private void textControl1_Changed(object sender, EventArgs e) {
ToggleMarkup();
}
private void ToggleMarkup() {
foreach (TXTextControl.TrackedChange change in textControl1.TrackedChanges) {
if (change.ChangeKind == TXTextControl.ChangeKind.DeletedText)
continue;
change.HighlightMode = _isMarkupVisible == true ?
TXTextControl.HighlightMode.Always :
TXTextControl.HighlightMode.Never;
}
}
This method loops through all TrackedAlways or Never according to the state of _isMarkupVisible. Only deleted text will be displayed which is checked using the Change
As each tracked change object can be adjusted separately, you can also define other rules to display changes based on the time stamp, the user, the type of the change or the text itself.
Also See
This post references the following in the documentation:
- TXText
Control. Text Control. Changed Event - TXText
Control. Tracked Change. Change Kind Property - TXText
Control. Tracked Change Class - TXText
Control. Tracked Change. Highlight Mode Property
ASP.NET
Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.
- Angular
- Blazor
- React
- JavaScript
- ASP.NET MVC, ASP.NET Core, and WebForms
Related Posts
Powerful Extension Methods to Handle Tracked Changes
Custom extension methods for the TX Text Control X16 TrackedChangeCollection simplify bulk handling of tracked changes across all document text parts. A single call accepts or rejects all…
TXTextControl.Markdown.Core 34.1.0-beta: Work with Full Documents,…
In this article, we will explore the new features and improvements in TXTextControl.Markdown.Core 34.1.0-beta, including working with full documents, selection, and SubTextParts. We will also…
TX Spell .NET 11.0 SP1 is Now Available: What's New in the Latest Version
TX Spell .NET 11.0 Service Pack 1 is now available, offering important updates and bug fixes for all platforms. If you use TX Spell .NET in your document processing applications, this service pack…
TX Text Control 34.0 SP2 is Now Available: What's New in the Latest Version
TX Text Control 34.0 Service Pack 2 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…
TX Text Control 34.0 SP1 is Now Available: What's New in the Latest Version
TX Text Control 34.0 Service Pack 1 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…
