Back to Devexpress

Document.TrackedMovesConflict Event

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-document-7d5c8013.md

latest3.9 KB
Original Source

Document.TrackedMovesConflict Event

Occurs when moved text has been changed since it was moved.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
event TrackedMovesConflictEventHandler TrackedMovesConflict
vb
Event TrackedMovesConflict As TrackedMovesConflictEventHandler

Event Data

The TrackedMovesConflict event's data class is TrackedMovesConflictEventArgs. The following properties provide information specific to this event:

PropertyDescription
NewLocationRangeProvides access to the range of the moved text’s new location.
OriginalLocationRangeRetrieves the range of the moved text’s original location.
ResolveModeGets or sets what version of moved text to keep.
RevisionProvides access to the revision whose rejection fired the event.

Remarks

When you move text, change it, and then reject this move, a conflict occurs that fires Document.TrackedMovesConflict and RichEditDocumentServer.TrackedMovesConflict events.

The event does not occur if the new revision in the moved text was rejected.

You can obtain the original and new location range (OriginalLocationRange and NewLocationRange properties), and the revision that fired this event (the Revision property). Use the ResolveMode property to specify the version you want to keep.

The code sample below shows how to handle the TrackedMovesConflict event to keep original text:

csharp
private void WordProcessor_TrackedMovesConflict(object sender, TrackedMovesConflictEventArgs e)
{
  //Compare the length of the original and new location ranges
  //Keep text from the location which range is the smallest
  e.ResolveMode = (e.OriginalLocationRange.Length <= e.NewLocationRange.Length) ? TrackedMovesConflictResolveMode.KeepOriginalLocationText : TrackedMovesConflictResolveMode.KeepNewLocationText;
}
vb
Private Sub WordProcessor_TrackedMovesConflict(ByVal sender As Object, ByVal e As TrackedMovesConflictEventArgs)
    'Compare the length of the original and new location ranges
    'Keep text from the location which range is the smallest
    e.ResolveMode = If((e.OriginalLocationRange.Length <= e.NewLocationRange.Length), TrackedMovesConflictResolveMode.KeepOriginalLocationText, TrackedMovesConflictResolveMode.KeepNewLocationText)
End Sub

See Also

Document Interface

Document Members

DevExpress.XtraRichEdit.API.Native Namespace