Back to Devexpress

RichEditControl.TrackedMovesConflict Event

wpf-devexpress-dot-xpf-dot-richedit-dot-richeditcontrol-b453cd22.md

latest5.9 KB
Original Source

RichEditControl.TrackedMovesConflict Event

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

Namespace : DevExpress.Xpf.RichEdit

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

NuGet Package : DevExpress.Wpf.RichEdit

Declaration

csharp
public event TrackedMovesConflictEventHandler TrackedMovesConflict
vb
Public 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 RichEditControl.TrackedMovesConflict events. Handle one of the events to specify the version of the text you want to keep (the TrackedMovesConflictEventArgs.ResolveMode property).

Use the TrackedMovesConflictEventArgs.OriginalLocationRange and TrackedMovesConflictEventArgs.NewLocationRange properties to obtain the original and new location range, and the TrackedMovesConflictEventArgs.Revision property to retrieve the revision that fired this event.

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

csharp
private void WordProcessor_TrackedMovesConflict(object sender, TrackedMovesConflictEventArgs e)
{
  //Compare the length of the original and new location ranges
  //Keep text from the location whose 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 whose range is the smallest
    e.ResolveMode = If((e.OriginalLocationRange.Length <= e.NewLocationRange.Length), TrackedMovesConflictResolveMode.KeepOriginalLocationText, TrackedMovesConflictResolveMode.KeepNewLocationText)
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the TrackedMovesConflict event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-richedit-manage-tracked-changes/CS/DXRichEdit_TrackChanges/MainWindow.xaml#L10

xml
<Grid>
    <dxre:RichEditControl x:Name="richEditControl1" CommandBarStyle="Ribbon" TrackedMovesConflict="RichEditControl_TrackedMovesConflict">
        <dxre:RichEditControl.AnnotationOptions>

wpf-richedit-manage-tracked-changes/CS/DXRichEdit_TrackChanges/obj/Debug/net8.0-windows/MainWindow.g.cs#L100

csharp
#line 10 "..\..\..\MainWindow.xaml"
this.richEditControl1.TrackedMovesConflict += new DevExpress.XtraRichEdit.TrackedMovesConflictEventHandler(this.RichEditControl_TrackedMovesConflict);

wpf-richedit-manage-tracked-changes/VB/DXRichEdit_TrackChanges/obj.NetFX/Debug/MainWindow.g.vb#L99

vb
#ExternalSource("..\..\MainWindow.xaml",10)
AddHandler Me.richEditControl1.TrackedMovesConflict, New DevExpress.XtraRichEdit.TrackedMovesConflictEventHandler(AddressOf Me.RichEditControl_TrackedMovesConflict)

See Also

RichEditControl Class

RichEditControl Members

DevExpress.Xpf.RichEdit Namespace