Version

Working with Undo and Redo (XamSpreadsheet)

Purpose

This topic explains how to configure and perform undo and redo operations with the control.

Required background

The following table lists the concept and topics required as a prerequisite to understanding this topic.

Type Content

Concept

Infragistics Excel Engine

Topic Purpose

In this section you will find information that will help you to better understand the object model and the functionalities of the Infragistics Excel Engine .

This topic explains in details the features of the XamSpreadsheet control from developer perspective.

This topic provides an overview of the visual elements of the XamSpreadsheet control.

Undo and Redo Configuration Summary

Undo and Redo configuration summary

The XamSpreadsheet control uses the Infragistics Undo/Redo Framework to provide robust undo and redo support for the changes made by the user. The control tracks all changes made to the associated workbook and populates the UndoManager.

Note
Note

Each XamSpreadsheet control uses its own UndoManager instance. You can also use the same UndoManager across multiple XamSpreadsheet instances by setting this instance to the UndoManager property.

"Undo" and "Redo" operations are triggered via the following:

  • The user presses a specific key combination while the XamSpreadsheet has focus. For example, Ctrl + Z triggers an Undo operation while Ctrl + Y triggers a Redo operation.

  • Invoking the Undo and Redo commands (see code snippets below)

  • Calling the following methods

Undo and Redo configuration summary chart

The following table explains briefly the task which may be programmatically executed related to the undo and redo operations.

Task Details Property/ Command

Undo and Redo operations are enabled by default

Perform an undo operation

Undo

Perform a redo operation

Redo

Enable or Disable Undo and Redo Support

Overview

You can enable or disable the undo/redo support of the control using the IsUndoEnabled property.

Property settings

In order to: Use this property: And set it to:

Enable undo operation on a specific XamSpreadsheet instance.

IsUndoEnabled

true

Disable undo operation on a specific XamSpreadsheet instance.

IsUndoEnabled

false

Invoke Undo Operation Using Command

Overview

The redo operation incrementally backs out the changes inserted by the undo operation, 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 Undo operation on a specific XamSpreadsheet instance.

SpreadsheetCommandSource

EventName

CommandType

Method settings

In order to: Perform the following method: Set the desired enumerated value:

Perform the Undo operation on a specific XamSpreadsheet instance.

PerformAction

UltraSpreadsheetAction.Undo

Example

In XAML:

<Button Content="Undo"
    ig:Commanding.CommandTarget="{Binding ElementName=xamSpreadsheet1}">
    <ig:Commanding.Command>
        <igPrim:SpreadsheetCommandSource
            EventName="Click" CommandType="Undo" />
    </ig:Commanding.Command>
</Button>

Invoke Redo Operation Using Command

Overview

The redo operation incrementally backs out the changes inserted by the undo operation, 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 XamSpreadsheet instance.

SpreadsheetCommandSource

EventName

CommandType

Method settings

In order to: Perform the following method: Set the desired enumerated value:

Perform the Redo operation on a specific XamSpreadsheet instance.

PerformAction

UltraSpreadsheetAction.Redo

Example

In XAML:

< Button Content="Redo"
    ig:Commanding.CommandTarget="{Binding ElementName=xamSpreadsheet1}">
    <ig:Commanding.Command>
        <igPrim:SpreadsheetCommandSource
            EventName="Click" CommandType="Redo" />
    </ig:Commanding.Command>
</Button>

Related Content

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains the activation feature from developer perspective.

This topic explains the selection feature from developer perspective.