We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

From Stencil to INode

Thread ID:

Created:

Updated:

Platform:

Replies:

120575 Sep 27,2015 09:52 PM UTC Sep 29,2015 06:12 AM UTC WPF 3
loading
Tags: SfDiagram
Steven Brodhead
Asked On September 27, 2015 09:52 PM UTC

How do you get into the base Node interface for when you drop a Symbol from the Stencil to the SfDiagram?  I need to implement an INode so that I have full control over the contents, specifically in terms of creating ports.

Ranjitha Amirthalingam [Syncfusion]
Replied On September 28, 2015 12:24 PM UTC

Hi Steven,

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.

Steven Brodhead
Replied On September 28, 2015 09:14 PM UTC

ItemAdded is in SfDiagram.Info?  Thanks!  I would have never found it there, and would have probably ended up doing something horrifying like listening to the node collection for changes.

This helps a lot!

Ranjitha Amirthalingam [Syncfusion]
Replied On September 29, 2015 06:12 AM UTC

Hi Steven,

Thanks for your update.


Regards,
Ranjitha A.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;