Undo Problem

Hi!

I have undo/redo problem.
please help me.
1.button1 click : draw node and link.
2. "R2" Node Click, then link style change.
3. Undo button click .
problem : One link remains.l
What else do I have to do to my class so that I get undo/redo behavior?
Simplified code:
Form1.cs
=============================================
private RMDocument rmDoc = null;
private void Form1_Load(object sender, System.EventArgs e)
{
rmDoc = new RMDocument ();
this.goView1.Document = rmDoc;
}
private void button1_Click(object sender, System.EventArgs e)
{
rmDoc.StartTransaction ();
RMNode r1 = new RMNode();
r1.Text = "R1";
r1.Location = new PointF ( 100,100 );
rmDoc.NodeGroupsLayer.Add(r1);
RMNode r2 = new RMNode();
r2.Text = "R2";
r2.Location = new PointF ( 200,200 );
rmDoc.NodeGroupsLayer.Add(r2);
GoLink link = new GoLink();
link.FromPort = r1.RightPort;
link.ToPort = r2.LeftPort;
rmDoc.LinksLayer.Add ( link );

rmDoc.FinishTransaction ("========");

}

private void button2_Click(object sender, System.EventArgs e)
{
rmDoc.Undo();
}
private void button3_Click(object sender, System.EventArgs e)
{
rmDoc.Redo();
}
=============================================
public class RMDocument : GoDocument
{
public Northwoods.Go.GoLayer NodeGroupsLayer = null;
public Northwoods.Go.GoLayer SelectedLinksLayer = null;
public RMDocument()
{
this.LinksLayer = this.Layers.CreateNewLayerBefore(this.Layers.Default);
this.NodeGroupsLayer = this.Layers.CreateNewLayerBefore(this.Layers.Default);
this.SelectedLinksLayer = this.Layers.CreateNewLayerAfter(this.Layers.Default);
this.UndoManager = new GoUndoManager();
this.MaintainsPartID = true;
}
}
public class RMNode : GoTextNode
{
public override void OnGotSelection(GoSelection sel)
{
foreach ( GoLink link in this.Links)
{
link.Style = GoStrokeStyle.Bezier;
link.Document.Layers.Top.Add ( link );
}

base.OnGotSelection (sel);
}
public override void OnLostSelection(GoSelection sel)
{
foreach ( GoLink link in this.Links)
{
link.Style = GoStrokeStyle.Line ;
if ( !link.BeingRemoved )
link.Document.LinksLayer.Add ( link );
}
base.OnLostSelection (sel);
}
}

You were careful about making sure the document changes you made in button1_Click were wrapped in a transaction, but you didn’t put the changes to the GoLink.Style and its layer in transactions too.

Thanks! walter.