Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic how to make GruoupNode's children nodes can be selected after execute Undo method ? (Read 1546 times)
heyx
Junior Member
**
Offline


I Love MindFusion!

Posts: 69
Joined: Oct 9th, 2014
how to make GruoupNode's children nodes can be selected after execute Undo method ?
Apr 1st, 2015 at 7:03am
Print Post  
hi,
   I make a groupNode use this code:
Code
Select All
public void GroupNodes()
        {
            if (DesignDiagram.Selection.Nodes.Count > 1)
            {
                var groupNode = DesignDiagram.Factory.CreateShapeNode(0, 0, 1, 1);
                groupNode.ZBottom(false);
                groupNode.Transparent = true;

                groupNode.HandlesStyle = HandlesStyle.Custom;
                groupNode.Tag = "Group";
                CreateGroup(groupNode, DesignDiagram.Selection.Nodes);
                foreach (DiagramNode child in groupNode.SubordinateGroup.AttachedNodes)
                {
                    child.Locked = true;
                    child.DataContext = groupNode;
                }

                DesignDiagram.Selection.Change(groupNode);
            }
        }
 private void CreateGroup(DiagramNode node, DiagramNodeCollection children)
        {
            Rect r = Rect.Empty;
            foreach (DiagramNode child in children)
            {
                Rect cb = child.Bounds;
                r = r.IsEmpty ? cb : Rect.Union(r, cb);
            }
            double margin = 2;

            r.Inflate(margin, margin);
            node.Bounds = r;
            node.SizeChanged += node_SizeChanged;
            node.MouseEnter += currentSelectNode_MouseEnter;
            node.MouseLeave += currentSelectNode_MouseLeave;
            node.Expandable = false;
            foreach (DiagramNode child in children)
            {
                child.AttachTo(node, AttachToNode.TopLeft);
            }
        }
 


and then I exceute Diagram.UndoManager.Undo() method, but I can't select my children-node anymore.
could you please give me some help ?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to make GruoupNode's children nodes can be selected after execute Undo method ?
Reply #1 - Apr 1st, 2015 at 7:35am
Print Post  
Hi,

Nodes cannot be selected if you set their Locked property. Also property changes are not saved for undo/redo automatically since the control cannot know when separate assignments should be grouped into commands. Instead, you should explicitly create ChangeItemCmd commands to enable undo/redo of property values. You can find an example here:
http://www.mindfusion.eu/onlinehelp/wpfdiagram/index.htm?CC_Undo_or_Redo_of_Prop...

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint