Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic OutgoingLinks Not Correct (Read 4287 times)
dolfandon
Junior Member
**
Offline



Posts: 51
Location: Northern Virginia
Joined: Mar 12th, 2009
OutgoingLinks Not Correct
Jan 8th, 2010 at 4:09pm
Print Post  
When I get the property "OutgoingLinks" from a DiagramNode object, it is always empty. It doesn't seem to matter how many links are present and originate at the node, that property is always empty. Is this a known issue?

           DiagramLinkCollection links = node.OutgoingLinks;

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: OutgoingLinks Not Correct
Reply #1 - Jan 8th, 2010 at 5:47pm
Print Post  
Is it a TableNode? The links could be accessed through the OutgoingLinks property of individual rows then.
  
Back to top
 
IP Logged
 
dolfandon
Junior Member
**
Offline



Posts: 51
Location: Northern Virginia
Joined: Mar 12th, 2009
Re: OutgoingLinks Not Correct
Reply #2 - Jan 8th, 2010 at 6:02pm
Print Post  
No, these are ShapeNodes.

           ShapeNode node = new ShapeNode(FlowDiagram)
                                {
                                    Bounds = new Rect(FlowTask.XLocation, FlowTask.YLocation, 32, 32),
                                    Image = new BitmapImage(new Uri(imageUri, UriKind.RelativeOrAbsolute)),
                                    ImageAlign = ImageAlign.Center,
                                    Transparent = true,
                                    Pen = new Pen(Brushes.Black),
                                    Tag = new TaskNodeTag(FlowTask, SUBSCRIPTIONID, flow, ISPROPERTIESEDITABLE, cn),
                                    BorderBrush = new SolidColorBrush(Colors.Black),
                                    BorderThickness = new Thickness(1, 1, 1, 1),
                                    AnchorPattern = anchorPattern,
                                    Locked = true,
                                   
                                };
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: OutgoingLinks Not Correct
Reply #3 - Jan 8th, 2010 at 6:43pm
Print Post  
If you run this code,

var link = diagram.Factory.CreateDiagramLink(node, node2);

does node.OutgoingLinks remain empty?
  
Back to top
 
IP Logged
 
dolfandon
Junior Member
**
Offline



Posts: 51
Location: Northern Virginia
Joined: Mar 12th, 2009
Re: OutgoingLinks Not Correct
Reply #4 - Jan 11th, 2010 at 2:08pm
Print Post  
Yes, this does work. I guess I am not sure why it makes a difference. I was just creating a new link, setting the from and to node and adding it to the diagram.

               foreach (DiagramNode node in diagram.Nodes)
               {
                   if (node is ContainerNode)
                   {
                       if (fromTaskId == ((TaskNodeTag)((ContainerNode)node).Children[0].Tag).Task.Id)
                       {
                           fromNode = (ShapeNode)node;
                       }
                       else if (toTask == ((TaskNodeTag)((ContainerNode)node).Children[0].Tag).Task.Id)
                       {
                           toNode = (ShapeNode)node;
                       }
                   }
               }
               if (fromNode != null && toNode != null)
               {
                   DiagramLink link = new DiagramLink(diagram, fromNode, toNode)
                                          {
                                              Pen = routePen,
                                              Brush = routeBrush,
                                              HeadPen = routePen,
                                              TextBrush = routeTextBrush,
                                              Style = procPrefs.StrightLines ? LinkStyle.Polyline : LinkStyle.Bezier,
                                              Tag = new RouteLinkTag(route, -1, flow.ProcessId, true, ((TaskNodeTag) ((ContainerNode) fromNode).Children[0].Tag).TaskType, ((TaskNodeTag) ((ContainerNode) toNode).Children[0].Tag).TaskType, ((TaskNodeTag) ((ContainerNode) fromNode).Children[0].Tag).TaskDescription, ((TaskNodeTag) ((ContainerNode) toNode).Children[0].Tag).TaskDescription),
                                              Text = route.Description,
                                              Dynamic = true,
                                          };
diagram.Links.Add(link2);


If this a bug in the diagram controls or is this an incorrect way of doing it?

Don
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: OutgoingLinks Not Correct
Reply #5 - Jan 11th, 2010 at 2:19pm
Print Post  
The Incoming/OutgoingLinks collections of the nodes are updated by the Links.Add() method. Were you checking them before adding the link to the diagram?
  
Back to top
 
IP Logged
 
dolfandon
Junior Member
**
Offline



Posts: 51
Location: Northern Virginia
Joined: Mar 12th, 2009
Re: OutgoingLinks Not Correct
Reply #6 - Jan 11th, 2010 at 3:23pm
Print Post  
No, I was checking them afterward.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: OutgoingLinks Not Correct
Reply #7 - Jan 11th, 2010 at 3:31pm
Print Post  
Are you sure you weren't checking toNode.OutgoingLinks instead of fromNode.OutgoingLinks? It this collection wasn't updated correctly, many features would not work at all, e.g. TreeLayout, expand/collapse, etc, and we should have noticed that at some point.
  
Back to top
 
IP Logged
 
dolfandon
Junior Member
**
Offline



Posts: 51
Location: Northern Virginia
Joined: Mar 12th, 2009
Re: OutgoingLinks Not Correct
Reply #8 - Jan 12th, 2010 at 5:46pm
Print Post  
I finally figured this out. We use a container node so that the text moves with the image when the user drags a node around but they can not select it. This also allows the arrows of the links to be outside the text. The double click event gives us the shape node that holds the image and not the container node. If I look at the parent (which is the container node) I get the outbound links. Thanks.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint