Products Technologies Demo Docs Blog Support Company

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: Toggle Markup

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.

Toggle tracked changes

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 TrackedChange objects to set the HighlightMode property to Always or Never according to the state of _isMarkupVisible. Only deleted text will be displayed which is checked using the ChangeKind property.

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.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Also See

This post references the following in the documentation:

  • TXTextControl.TextControl.Changed Event
  • TXTextControl.TrackedChange.ChangeKind Property
  • TXTextControl.TrackedChange Class
  • TXTextControl.TrackedChange.HighlightMode 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.

ASP.NET Core
Angular
Blazor
JavaScript
React
  • Angular
  • Blazor
  • React
  • JavaScript
  • ASP.NET MVC, ASP.NET Core, and WebForms

Learn more Trial token Download trial

Related Posts

ASP.NETWindows FormsWPF

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.


ASP.NETWindows FormsWPF

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…


ASP.NETWindows FormsWPF

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…


ASP.NETWindows FormsWPF

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…


ActiveXASP.NETWindows Forms

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.