Search
Actions and Commands

Undoable interactive actions and programmatic commands that can be carried out by MindFusion.Diagramming for .NET MAUI are represented by Command subclasses. The Command class provides the necessary interface to Execute, Undo or Redo actions. In some cases you will have to implement these methods in derived classes, but you must not call them directly. Use the Undo or Redo methods of the UndoManager to undo or redo a command. The UndoManager methods call the respective Command methods and in addition update the state of the command history and the Diagram.

The following MindFusion.Diagramming for .NET MAUI classes are derived from Command:

Command

Description

AddItemCmd

Adds a new item to the diagram.

RemoveItemCmd

Removes an item from the diagram.

AddToContainerCmd

Adds a child node to a container.

RemoveFromContainerCmd

Removes a child node from a container.

ModifyItemCmd

Moves or resizes an item.

RedimTableCmd

Change number of table's columns or rows.

ExpandItemCmd

Expands or collapses a tree of items.

ScrollTableCmd

Scrolls table's rows.

ExpandHeaderRowCmd

Expands or collapses tables sections.

ChangeItemCmd

Handles undo/redo of item property changes.

CompositeCmd

Allows several actions to be undo and redone at the same time.

Instances of most of these classes are created implicitly by MindFusion.Diagramming for .NET MAUI in response to users' actions or method calls. You might need to explicitly instantiate only ChangeItemCmd - to undo or redo property changes - and CompositeCmd - to present several actions as single undoable operation.

The data of your application might be tightly integrated in MindFusion.Diagramming for .NET MAUI diagrams, for example via Tag objects or .NET controls embedded in ControlNode items. In these cases MindFusion.Diagramming for .NET MAUI cannot detect, undo or redo changes to your data. To enable undo of such changes, you must inherit the Command class and implement your versions of the Execute, Undo and Redo methods. To record your own action in the undo/redo history, call the ExecuteCommand method of the Diagram class.