Version

UndoManager Properties and Methods Reference

Topic Overview

Purpose

This topic lists some of the important properties and methods of the UndoManager class.

UndoManager Class Reference

Introduction

The UndoManager class provides the functionality for performing undo/redo operations and maintaining the undo/redo history.

Performed operations are saved in history by adding UndoUnit instances to the UndoManager.

Note
Note

The UndoManager class is not thread safe and it has to be used on a single thread.

About UndoManager 1.png

Properties reference summary

The following table summarizes the purpose and functionality of the UndoManager class key properties.

Property Description

Returns a boolean value indicating if there is an operation that can be redone.

This property determines if there are UndoUnits in the RedoHistory.

Returns a boolean value indicating if there is an operation that can be undone.

This property determines if there are UndoUnits in the UndoHistory.

Returns a thread static singleton instance of an UndoManager.

Another way to use the UndoManager class is to create a new instance. Each instance maintains its own history.

Returns a boolean value indicating if the manager is performing a redo operation.

While IsPerformingRedo is True, the UndoUnits are added in the undo history because redo operations are performed.

Returns a boolean value indicating if the manager is performing an undo operation.

While IsPerformingUndo is True, the UndoUnits are added in the redo history because undo operations are performed.

Returns a read-only collection of the UndoHistoryItem instances in the redo history.

Returns a read-only collection of the UndoHistoryItem instances in the undo history.

Methods reference summary

The following table summarizes the purpose and functionality of the UndoManager class key methods.

Method Description

Adds an UndoUnit to the history.

There are several overloads of this method.

One of them takes a given UndoUnit as an argument.

The others take Action or Func<> instances that represents the methods to call when the operation is undone/redone.

Adds an UndoUnit for the specified collection change to the undo history.

Adds a PropertyChangeUndoUnitBase for the specified property value change to the undo history.

Clears the undo and redo history.

Enumerates the UndoUnit instances within the undo and redo history and invokes the provided Action<UndoUnit> delegate.

Once an object is associated with the UndoManager, you can use this to obtain a reference to the UndoManager instance when it’s needed.

Performs one or more redo operations using the current history.

Associates an object with an UndoManager instance.

Resumes the suspended recording of UndoUnit instances in the history.

Creates and starts an UndoTransaction. This is useful when multiple operations have to be saved in the undo/redo history as one entry.

Suspends the recording of UndoUnit instances in the history.

You may need this method when initializing objects or collections or loading initial data.

When the recording is suspended, calling the Undo or Redo methods will result in an exception.

Performs one or more undo operations using the current history.

Removes a registration created with RegisterReference method for an object that was registered with UndoManager instance.

Related Content

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic lists some of the important properties and methods of the ObservableCollectionExtendedWithUndo class.

This topic lists the properties and methods of the UndoHistoryItem class.

This topic lists the derived classes and some of the important properties and methods of the UndoUnit class.

This topic lists some of the important properties and methods of the UndoUnitFactory class.