ChangeItemCmd Class
Remarks See Also

Handles undo / redo of programmatic property changes.

Namespace: MindFusion.Diagramming.Commands
Package: MindFusion.Diagramming


C#  Copy Code

public class ChangeItemCmd : Command

Visual Basic  Copy Code

Public Class ChangeItemCmd
    Inherits Command


You would create an instance of this class in order to enable undo / redo of changes to item's properties. The constructor records the initial state of the item and the Execute method records the final state and adds the ChangeItemCmd object to the undo manager's history.


C#  Copy Code

// Save item state
ChangeItemCmd propChange = new ChangeItemCmd(diagram.Nodes[0], "Change");

// Change properties
ShapeNode shape = (ShapeNode)diagram.Nodes[0];
shape.Text = "new text";
shape.Brush = new SolidBrush(Color.Blue);
shape.Shape = Shape.FromId("Ellipse");

// Add to history

Visual Basic  Copy Code

' Save item state
Dim propChange As ChangeItemCmd = New ChangeItemCmd(Diagram.Nodes(0), "Change")

' Change properties
Dim shape As ShapeNode = CType(Diagram.Nodes(0), ShapeNode)
Shape.Text = "new text"
Shape.Brush = New SolidBrush(Color.Blue)
shape.Shape = MindFusion.Diagramming.Shape.FromId("Ellipse")

' Add to history

 Inheritance Hierarchy


 See Also