[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Collapse]Form Layout Managers
    Side Panel
   [Collapse]Layout and Data Layout Controls
    [Expand]Product Information
    [Expand]Getting Started
    [Expand]Layout Control
    [Expand]Data Layout Control
    [Expand]Layout Items
    [Expand]Layout Groups
    [Expand]Tabbed Groups
    [Expand]Other Layout Elements
    [Collapse]Design-Time and Runtime Customization
      Design-Time Customization
      Design-Time Actions: Adding and Removing Controls and Layout Items
      Design-Time Actions: Resizing and Moving Layout Items
      Design-Time Actions: Selecting Controls and Layout Items
      Context Menu
      Customization Form
      Runtime Undo/Redo
      Creating Layout Items at Design Time
      Creating Tabbed Groups at Design Time
      Design-Time Layout Templates
      Dragging Layout Items at Design Time
      Layout Tree View
      Selecting Layout Items at Design Time
      Runtime Customization Overview
      Default Runtime Customization
      Quick Runtime Customization
    [Expand]Size and Alignment
     Flow Layout
     Table Layout
     Focus Management
    [Expand]Appearance and Look and Feel
    [Expand]Member Tables
   [Expand]Tabbed MDI Manager
    Tab Control
   [Expand]Wizard Control
    Workspace Manager
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Runtime Undo/Redo

The Layout Control provides the built-in support for multiple Undo/Redo. When an end-user changes the layout, the Layout Control tracks the changes within the layout via its Undo Manager. The end-user can then perform undo or redo operations by clicking the Undo and Redo buttons within the Customization Form. It's also possible to perform undo and redo operations in code using the methods provided by the Undo Manager.

The Undo Manager (LayoutControl.UndoManager) tracks the changes made by an end-user within the Layout Control. It stores all the changes within the undo stack. Each time an end-user changes the layout a new element that represents the previous layout serialization memory dump is appended to the undo stack. When an Undo operation is performed, the current position in the undo stack is moved to the left. The Redo operation moves the current position to the right. When performing Undo/Redo operations the Undo Manager restores the layout from the element at the current position within the undo stack.

This mechanism is illustrated in the image below:

The Undo Manager provides the methods and properties that allow you to identify whether the undo or redo operation can be performed, perform these operations manually, clear the undo stack. All these properties and methods are described in the table below:

Member Description
IsUndoAllowed Indicates whether the Undo operation can be performed. This operation isn't available if the layout hasn't been changed yet by an end-user.
IsRedoAllowed Indicates whether the Redo operation can be performed. This operation is available only after the Undo operation(s) has been performed.
Undo Performs the Undo operation.
Redo Performs the Redo operation.
Reset Clears the undo stack.
UndoStackChanged Occurs after the layout has been changed by an end-user and this change has been tracked by the undo manager (a new element has been added to the undo stack). Note this event isn't raised after the Undo or Redo operation has been performed.

Is this topic helpful?​​​​​​​