Tracking Document Changes

To see who has been making text changes to a document a TextControl offers the track changes feature. It can be turned on or off with the new TextControl.IsTrackChangesEnabled or WPF.TextControl.IsTrackChangesEnabled properties. When the feature is turned on, a TextControl marks up new text changes made to the document. When it is turned off, marking up new changes are stopped. Any changes that were already tracked remain marked up in the document until they are removed. All tracked changes in a document are available through a TrackedChangeCollection which can be obtained through the new TextControl.TrackedChanges or WPF.TextControl.TrackedChanges properties. Every TrackedChange in the collection has a Start and a Length. The ChangeKind property determines the kind of change, deleted or inserted text. The only way to remove tracked changes in a document is to accept or to reject them with the TrackedChangeCollection.Remove method. Each tracked change has a change time and is related to a user. When a new change is tracked, the current user is associated with the change. The current user is the first in the list of users set with the TextControl.UserNames property. When the list of users is empty, the subtextpart's name is set to an empty string which is interpreted as an unknown user. Events occur, when a tracked change is created (TrackedChangeCreated), deleted (TrackedChangeDeleted) or changed (TrackedChangeChanged). A tracked change is highlighted on the screen with a color depending on the user, the default color for the current user is red. Newly inserted text is highlighted through colored text, deleted text is highlighted through colored and strikethrough text. Some complex text operations, for example deleting a table column cannot be tracked. In these cases a CannotTrackChange event occur and the end-user can decide whether the change is made. Tracked changes are saved and can be reloaded with the TextControl text format (.tx), the Rich Text Format (.rtf) and the Microsoft Word formats (.doc, .docx).

Classes

Class Description
TXTextControl.CannotTrackChangeEventArgs The CannotTrackChangeEventArgs class provides data for the CannotTrackChange event.
TXTextControl.TrackedChange A TrackedChange object represents a change made to the document after anyone has revised the document.
TXTextControl.TrackedChangeCollection Contains all tracked changes in the main text or another part of a document.
TXTextControl.TrackedChangeEventArgs The TrackedChangeEventArgs class provides data for the TrackedChangeChanged, TrackedChangeCreated, TrackedChangeStateChanged and TrackedChangeDeleted events.

Events

Event Description
TXTextControl.ServerTextControl.TrackedChangeCreated Occurs when a tracked change has been created.
TXTextControl.ServerTextControl.TrackedChangeDeleted Occurs when a tracked change has been deleted.
TXTextControl.WPF.TextControl.CannotTrackChange Determines how to handle a change of the document that cannot be added to the list of tracked changes.
TXTextControl.WPF.TextControl.TrackedChangeChanged Occurs when the text of a tracked change has been altered.
TXTextControl.WPF.TextControl.TrackedChangeCreated Occurs when a tracked change has been created.
TXTextControl.WPF.TextControl.TrackedChangeDeleted Occurs when a tracked change has been deleted.
TXTextControl.WPF.TextControl.TrackedChangeStateChanged Occurs when the state of a tracked change alters from active to inactive or vice versa.

Methods

Method Description
TXTextControl.ServerTextControl.OnTrackedChangeCreated Raises the TrackedChangeCreated event.
TXTextControl.ServerTextControl.OnTrackedChangeDeleted Raises the TrackedChangeDeleted event.
TXTextControl.TrackedChange.Save Saves the changed text with the specified format.
TXTextControl.TrackedChange.ScrollTo Sets the current input position to the first position of the changed text and scrolls it into the visible part of the document.
TXTextControl.TrackedChange.Select Selects the changed part of the document.
TXTextControl.TrackedChangeCollection.CopyTo Copies the elements of the collection to an array, starting at a particular index.
TXTextControl.TrackedChangeCollection.GetEnumerator Returns an enumerator that can be used to iterate through the collection.
TXTextControl.TrackedChangeCollection.GetItem Gets a particular item from the collection.
TXTextControl.TrackedChangeCollection.Remove Removes a tracked change from the collection.
TXTextControl.WPF.TextControl.OnCannotTrackChange Raises the CannotTrackChange event.
TXTextControl.WPF.TextControl.OnTrackedChangeChanged Raises the TrackedChangeChanged event.
TXTextControl.WPF.TextControl.OnTrackedChangeCreated Raises the TrackedChangeCreated event.
TXTextControl.WPF.TextControl.OnTrackedChangeDeleted Raises the TrackedChangeDeleted event.
TXTextControl.TextControl.OnTrackedChangeStateChanged Raises the TrackedChangeStateChanged event.

Properties

Property Description
TXTextControl.CannotTrackChangeEventArgs.Cancel Gets or sets a value indicating whether the change of the document should be performed.
TXTextControl.CannotTrackChangeEventArgs.DefaultMessage Gets the default message for the user.
TXTextControl.CannotTrackChangeEventArgs.Handled A subscriber can set this property to true to indicate that he has handled the event.
TXTextControl.ServerTextControl.TrackedChanges Gets a collection of all changes made in the active part of the document.
TXTextControl.TrackedChange.Active Gets or sets a value specifying whether the TrackedChange is currently active or not.
TXTextControl.TrackedChange.ChangeKind Gets the kind of change.
TXTextControl.TrackedChange.ChangeTime Gets the date and time when the change has been made.
TXTextControl.TrackedChange.DefaultHighlightColor Gets the default highlight color of a tracked change.
TXTextControl.TrackedChange.HighlightColor Gets or sets the highlight color for the tracked change.
TXTextControl.TrackedChange.HighlightMode Gets or sets a value indicating whether the tracked change is highlighted.
TXTextControl.TrackedChange.Length Gets the number of changed characters.
TXTextControl.TrackedChange.Number Gets the change's number.
TXTextControl.TrackedChange.Start Gets the index (one-based) of the first changed character.
TXTextControl.TrackedChange.Text Gets the changed text.
TXTextControl.TrackedChange.UserName Gets the name of the user who has changed the document.
TXTextControl.TrackedChangeCollection.Count Gets the number of elements contained in the collection.
TXTextControl.TrackedChangeCollection.IsSynchronized Returns true if the collection is designed to be thread safe, otherwise, it returns false.
TXTextControl.TrackedChangeCollection.Item Gets the change with the specified number from the collection.
TXTextControl.TrackedChangeCollection.SyncRoot Gets an object that can be used to synchronize access to the collection.
TXTextControl.TrackedChangeEventArgs.TrackedChange Gets an object that represents the tracked change which causes the event.
TXTextControl.WPF.TextControl.IsTrackChangesEnabled Gets or sets a value indicating whether track changes is active or not.
TXTextControl.WPF.TextControl.TrackedChanges Gets a collection of all changes made in the active part of the document.