// Demonstrates how to undo and redo the most recent operation using the map's operation manager. //undo if (activeMap.OperationManager.CanUndo) activeMap.OperationManager?.UndoAsync();//await as needed //redo if (MapView.Active.Map.OperationManager.CanRedo) activeMap.OperationManager?.RedoAsync();//await as needed }
{
// in order to find a dockpane you need to know its DAML id
pane = FrameworkApplication.DockPaneManager.Find(dockPaneID);
// get the undo stack
OperationManager manager = pane.OperationManager;
if (manager != null)
{
// undo an operation
// Use await with UndoAsync and RedoAsync
if (manager.CanUndo)
manager.UndoAsync().Wait();
// redo an operation
if (manager.CanRedo)
manager.RedoAsync().Wait();
// clear the undo and redo stack of operations of a particular category
manager.ClearUndoCategory("Some category");
manager.ClearRedoCategory("Some category");
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)