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
This article shows how to implement powerful extension methods to remove all tracked changes in all text parts by a given username.
TX Text Control 33.0 SP3 is Now Available: What's New in the Latest Version
TX Text Control 33.0 Service Pack 3 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 33.0 SP2 is Now Available: What's New in the Latest Version
TX Text Control 33.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…
Document Lifecycle Optimization: Leveraging TX Text Control's Internal Format
Maintaining the integrity and functionality of documents throughout their lifecycle is paramount. TX Text Control provides a robust ecosystem that focuses on preserving documents in their internal…
Expert Implementation Services for Legacy System Modernization
We are happy to officially announce our partnership with Quality Bytes, a specialized integration company with extensive experience in modernizing legacy systems with TX Text Control technologies.