<Button Content="Undo">
<ig:Commanding.Command>
<igPrim:SyntaxEditorCommandSource
EventName="Click" CommandType="Undo" TargetName="xamSyntaxEditor1" />
</ig:Commanding.Command>
</Button>
This topic explains the xamSyntaxEditor™ control’s Undo and Redo operations.
The following topics are prerequisites to understanding this topic:
This topic contains the following sections:
The xamSyntaxEditor control uses the Infragistics Undo/Redo Framework to provide robust undo redo support for text updates. The UndoManager is available programmatically via the TextDocument's UndoManager property. By default, each TextDocument
has its own UndoManager
, which means you will have a separate history of all changes for each TextDocument
in your application. Alternatively, you can configure a single UndoManager
to multiple TextDocuments
thereby allowing you to have a shared history tracking all the revisions across all TextDocuments.
‘Undo’ and ‘Redo’ operations are triggered via the following:
The user presses a specific key combination while the XamSyntaxEditor has focus. For example, Ctrl + Z triggers an Undo operation while Ctrl + Y triggers a Redo operation on the TextDocument
under edit.
Invoking the Undo and Redo commands (see code snippets below)
Calling one of the following methods
The following table lists the Undo and Redo operation with details.
The undo operation incrementally rolls back the last changes made on the TextDocument
, pops the Undo operation record off the undo history stack and adds it to the top of the Redo history stack.
In XAML:
<Button Content="Undo">
<ig:Commanding.Command>
<igPrim:SyntaxEditorCommandSource
EventName="Click" CommandType="Undo" TargetName="xamSyntaxEditor1" />
</ig:Commanding.Command>
</Button>
The Redo operation incrementally backs out the changes inserted by the Undo operation on the TextDocument
, pops the Undo operation record off the redo history stack and adds it to the top of the undo history stack.
In XAML:
<Button Content="Redo">
<ig:Commanding.Command>
<igPrim:SyntaxEditorCommandSource
EventName="Click" CommandType="Redo" TargetName="xamSyntaxEditor1" />
</ig:Commanding.Command>
</Button>
The following topics provide additional information related to this topic.