when I change the height of swimlanes, how to make the height of the nodes in swimlane change together?

When I create a new swimlane, my code will create a new node in the same new swimlane, but when I change the height of the swimlane, how can I change the height of the node at the same time to make it the same height as the swimlane

?


8 Replies

DT Deepa Thiruppathy Syncfusion Team May 26, 2022 09:34 AM UTC

Hi Tealer,


We could not get your exact requirement. We request you share below details from your side,


  1. Are you adding Swimlane and lane nodes from the code behind or do you drag and drop the Swimlane from stencil?
  2. Nodes will be placed inside the Lanes. In this case do you need node and lane in Same size. We request you to share any image representation for your requirement. It will help us to get your requirement earlier.


Regards,

Deepa Thiruppathy



TE tealer replied to Deepa Thiruppathy May 29, 2022 11:59 AM UTC

Thank you for your reply.

I was added Swimlane and lane nodes from the code behind.

Here is a picture that reflects my needs


(Sorry about the rough picture)

When I create new lanes, I automatically generate a node at the fixed position of each lane, and this node is set to be immovable. 

Now the effect I want to achieve is that when I adjust the height of the lane with the mouse, the node in the corresponding lane can also adjust the height accordingly. 

For example, the height of the lane is increased by 100, and the height of the node in this lane will also be increase by 100.



DT Deepa Thiruppathy Syncfusion Team May 30, 2022 04:44 PM UTC

Requirement: How to resize the Node when its parent lane is getting resized.


Currently we do not have any direct support to achieve your requirement. We will try any work-around solution and update you the details on June 1, 2022.



DT Deepa Thiruppathy Syncfusion Team June 1, 2022 09:10 AM UTC

Hi Tealer,


Requirement: How to resize the Node when its parent lane is getting resized.


We have achieved this requirement by creating custom class of LaneViewModel and its OnPropertyChanged method. When height of the lane is changed, then OnPropertyChanged method will be notified for UnitHeight property. We have updated the changed height value to lane children’s nodes. In addition to that, to maintain the position to node, OffsetY value also updated accordingly.


Code snippet:

/// <summary>

/// Represents a class to scale the height of the node as lane height.

/// </summary>

public class CustoLaneVM : LaneViewModel

{

    double previousHeight;

    protected override void OnPropertyChanged(string name)

    {

        base.OnPropertyChanged(name);

        if (name == "UnitHeight")

        {

            //finding differnce between current lane height and previous height.

            double heightDifference = this.UnitHeight - previousHeight;

            foreach (NodeViewModel node in this.Children as LaneChildren)

            {

                //updating height difference to lane's child node and updating OffsetY position according to that.

                node.LaneOffsetY += (heightDifference * 0.5);

                node.OffsetY += (heightDifference * 0.5);

                node.UnitHeight += heightDifference;

            }

        }

 

        previousHeight = this.UnitHeight;

    }

}



Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/LaneNodeHeightCustomazation2059903399



TE tealer June 7, 2022 08:03 AM UTC

thank you for your reply.

It works fine on my project.But when I reduce the width of the lane with the mouse to less than the height of this automatically stretched node, I get an error and programe exit.



DT Deepa Thiruppathy Syncfusion Team June 9, 2022 12:02 PM UTC

Hi Tealer,


We have modified the sample to avoid exception on lane resizing when the lane children’s size is less than the lane’s height.


Modified sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/LaneNodeCustomHeightModified-1486691694



TE tealer replied to Deepa Thiruppathy June 10, 2022 02:26 AM UTC

Thank you for solving my problem



DT Deepa Thiruppathy Syncfusion Team June 13, 2022 04:17 AM UTC

You are welcome. Please let us know if you require any further assistance.


Loader.
Up arrow icon