Example
<Button Content="Undo">
<ig:Commanding.Command>
<igPrim:RichTextEditorCommandSource
EventName="Click" CommandType="Undo" TargetName="xamRichTextEditor1" />
</ig:Commanding.Command>
</Button>
This topic explains the xamRichTextEditor ™ control’s Undo and Redo operations from a developer’s perspective.
The following topics are prerequisites to understanding this topic:
This topic contains the following sections:
The UndoManager is available programmatically via the RichTextDocument’s UndoManager property. By default, each RichTextDocument
has its own UndoManager
, which means you will have a separate history of all changes for each RichTextDocument
in your application. Alternatively, you can configure a single UndoManager
to multiple `RichTextDocument`s thereby allowing you to have a shared history tracking all the revisions across all `RichTextDocument`s.
The following table lists the Undo and Redo operation with details.
The undo operation incrementally rolls back the last changes made on the RichTextDocument
, returning the text to its original state, pops the Undo operation record off the undo history stack and adds it to the top of the Redo history stack.
In XAML:
Example
<Button Content="Undo">
<ig:Commanding.Command>
<igPrim:RichTextEditorCommandSource
EventName="Click" CommandType="Undo" TargetName="xamRichTextEditor1" />
</ig:Commanding.Command>
</Button>
In C#:
this.xamRichTextEditor1.Document.UndoManager.Undo();
In Visual Basic:
Me.xamRichTextEditor1.Document.UndoManager.Undo()
The Redo operation incrementally backs out the changes inserted by the Undo operation on the RichTextDocument
, returning the text to its most recently edited state, pops the Undo operation record off the redo history stack and adds it to the top of the undo history stack.
In XAML:
Example
<Button Content="Redo">
<ig:Commanding.Command>
<igPrim:RichTextEditorCommandSource
EventName="Click" CommandType="Redo" TargetName="xamRichTextEditor1" />
</ig:Commanding.Command>
</Button>
In C#:
this.xamRichTextEditor1.Document.UndoManager.Redo();
In Visual Basic:
Me.xamRichTextEditor1.Document.UndoManager.Redo()
The following topic provides additional information related to this topic.