Version

Undo / Redo (xamSyntaxEditor)

Topic Overview

Purpose

This topic explains the xamSyntaxEditor™ control’s Undo and Redo operations.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

In this topic, you will find information to help you better understand the xamSyntaxEditor’s functions.

This topic covers the text editing capabilities of the xamSyntaxEditor control from both the developer and user’s perspective.

In this topic

This topic contains the following sections:

Introduction

Introduction to the Undo and Redo support

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

Note
Note

For more information about the keyboard shortcuts, please refer to the Editing Support Overview topic.

Undo And Redo Configuration Summary

Undo and redo configuration summary chart

The following table lists the Undo and Redo operation with details.

Operation Details Command to invoke

Perform an Undo operation on the specified xamSyntaxEditor instance.

  • Undo

Perform a Redo operation on the specified xamSyntaxEditor instance.

  • Redo

Undo Operation

Overview

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.

Property settings

In order to: Instantiate the following command source: And set the following properties:

Perform the Undo operation on a specific xamSyntaxEditor instance.

Example

In XAML:

<Button Content="Undo">
    <ig:Commanding.Command>
        <igPrim:SyntaxEditorCommandSource
            EventName="Click" CommandType="Undo" TargetName="xamSyntaxEditor1" />
    </ig:Commanding.Command>
</Button>

Redo Operation

Overview

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.

Property settings

In order to: Instantiate the following command source: And set the following properties:

Perform the Redo operation on a specific xamSyntaxEditor instance.

SyntaxEditorCommandSource

EventName

CommandType

TargetName

Example

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.

Topic Purpose

This topic lists the events and supported commands available to you, while building your xamSyntaxEditor applications.

This topic provides extensible information as well as samples about the Infragistics Commanding framework.