From Stencil to INode
Thanks for contacting Syncfusion Support.
Requirement: Need to add Port for the dropped Node from the Stencil.
We have provided support for ItemAdded event in SfDiagram. This event will get invoked when Symbol dropped to SfDiagram from Stencil. ItemAddedEventsargs will help to identify the dropped Node. We have provided code example and sample to achieve your requirement. Please refer to the code example and sample as below.
Code Example:
|
void MainWindow_ItemAdded(object sender, ItemAddedEventArgs args) { if (args.ItemSource == ItemSource.Stencil) { var dropedItem = args.Item as INode;
if (dropedItem != null) { INodePort port1 = addPort(dropedItem, 0.5, 0.5); dropedItem.Ports = new ObservableCollection<INodePort>() { port1 };
}
}
}
private INodePort addPort(INode node, double p1, double p2) { NodePort v = new NodePort() { Width = 11, Height = 11, NodeOffsetX = p1, NodeOffsetY = p2, Node=node, Shape = new EllipseGeometry() { RadiusX = 10, RadiusY = 10 }, ShapeStyle = this.Resources["portstyle"] as Style, }; return v; |
Sample Link: DroppedNode_with_ports
Regards,
Ranjitha A.
Thanks for your update.
Regards,
Ranjitha A.
- 3 Replies
- 2 Participants
-
SB Steven Brodhead
- Sep 27, 2015 09:52 PM UTC
- Sep 29, 2015 06:12 AM UTC