Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Swim lanes in code (Read 2400 times)
donalmeida
Junior Member
**
Offline


Yay...

Posts: 65
Joined: Oct 6th, 2009
Swim lanes in code
Nov 13th, 2009 at 3:53pm
Print Post  
I create nodes and links in code and drop it on the diagram. after that I create swimlanes. I have found that if I have 3-4 lanes and add the fifth lane the last lane always comes on top of the tasks. all other lanes are ok but just the last lane always comes on top of all other nodes and links. I have set the Z-order to be 0. Here is the code I am using to display lanes.

int i = 0;
           foreach(SwimLaneDefinition swd in slgd.AssignedLanes  )
           {
              
            ShapeNode lane = diagram.Factory.CreateShapeNode(
                   0, i * swd.Height, currentDiagram.Width, swd.Height);
             lane.ZIndex = 0; // 1000;
             lane.Shape = Shapes.Rectangle;
             lane.Text = swd.Description;
             lane.TextFormat = new StringFormat(StringAlignment.Near, StringAlignment.Near);
           
           Color c = DiagramHelper.ConvertToMediaColor(swd.BackgroundColor);
           lane.Brush = new SolidColorBrush(c);
               lane.FontSize *= 1.5;
               lane.FontStretch = FontStretches.Normal;
               lane.EnabledHandles = AdjustmentHandles.ResizeBottomCenter;
               lane.AllowIncomingLinks = false;
               lane.AllowOutgoingLinks = false;
               if (currentContext.SwimLanes == null)
               {
                   currentContext.SwimLanes = new List<ShapeNode>();
               }
                currentContext.SwimLanes.Add(lane);
                   lane.Visible = false;
               i++;
           }
           UpdateLayout();

What's up with the last lane? I am puzzeled.
  

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Swim lanes in code
Reply #1 - Nov 13th, 2009 at 4:26pm
Print Post  
Are you also setting the ZIndex of task nodes? The control forces the ZIndex values to be in the range 0 .. items.Count - 1, and if you set ZIndex = 0 for several nodes, only the last one will be at 0, the rest will shift up in the Z order. So if you set task nodes' ZIndex to let's say 2, that will shift some of the lane nodes up...
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint