Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Collapse]Form Layout Managers
    Side Panel
   [Collapse]Layout Manager
    [Expand]Product Information
    [Expand]Getting Started
    [Expand]Layout Control
    [Expand]Data Layout Control
    [Expand]Layout Item
    [Expand]Layout Groups
    [Expand]Tabbed Group
    [Expand]Other Layout Elements
    [Collapse]Customization Capabilities
      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]Miscellaneous
    [Expand]Examples
    [Expand]Member Tables
   [Expand]Tabbed MDI Manager
    Tab Control
   [Expand]Wizard Control
    Workspace Manager
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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.

How would you rate this topic?​​​​​​​