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
?
Hi Tealer,
We could not get your exact requirement. We request you share below details from your side,
Regards,
Deepa Thiruppathy
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.
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.
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
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.
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
You are welcome. Please let us know if you require any further assistance.