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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom Node Issue?

Thread ID:

Created:

Updated:

Platform:

Replies:

115088 Dec 23,2013 10:10 AM UTC Jan 22,2014 05:02 AM UTC WPF 10
loading
Tags: Diagram
Domenico Mozzone
Asked On December 23, 2013 10:10 AM UTC

Good Morning,
I was asked to verify the feasibility of porting WinForm  in WPF
Projects use the Diagram library with a good number of Custom Node and connectors.

I firstly try to design a Custon Node and Connector. All right with connector but no way to have a custom Node. An exception is thrown when dropping the custom node the the diagram.
I'm quite sure to follow a bad way, but no I have good examples on the matter.

Thease see the attached test; dropping the custom symbol on the diagram an exception is thrown.

Best regards


CustomSymbols_20131223_101729Z_68a37097.zip

Parthiban A [Syncfusion]
Replied On January 2, 2014 12:30 PM UTC

Hi,

Due to some technical problems, the sample is not uploaded correctly. Could you please resend the sample?
 
Regards,
Parthiban A.

Domenico Mozzone
Replied On January 8, 2014 03:21 PM UTC

Hi Parthiban,
please find in attachment the example
Kind regards
Domenico


CustomSymbols_20131223_101729Z_7346b00f.zip

Parthiban A [Syncfusion]
Replied On January 10, 2014 09:26 AM UTC

Hi Domenico,

WPF control can be hosted into windows forms and vice versa, though they have limitations too. Kindly refer the below msdn links to for more about hosting feasibility.

http://msdn.microsoft.com/en-us/library/ms751761(v=vs.110).aspx

http://msdn.microsoft.com/en-us/library/ms742875(v=vs.110).aspx

We have analysed the provided sample, we found that you have override the symbol palette items CloneContent function. It is used to set the symbol palette items content at runtime, which can be any business object or any other. You have tried to set node as symbol palette item content, exception thrown due to some xml serialization limitations. Since xml serializer couldn’t serialize generic collections. Here it tries to serialize observable collection Ports in node.

 We suggest that no need to set node as symbol palette item content. By default if you drag and drop any symbol palette item from palette, node will be added to diagram page and symbol palette item content is set to nodes content. In your scenario path is symbol palette items content, now when you drag drop to diagram page, created node will have same path as its content. Hence there is no need to override the content while runtime.

Kindly try the sample without overriding the CloneContent function. If you need to do so, set node as symbol palette item’s content while creating. Kindly find the modified sample below.

Please let us know, if you require further assist on this.

Regards,

Parthiban A.



CustomSymbols_20131223_101729Z_7346b00f_583c7ba2.zip

Domenico Mozzone
Replied On January 13, 2014 08:48 AM UTC

Hi Parthiban,
thank you for your reply. You are right, but I think that I not well explained what I'd like to do.
My need is to have a node with custom aspect, but also with custom properties (in the example CustomId).
Dropping without cloning, I have a Node object added to the Model.Nodes Collection, not my Custom node AcGen with its properties, isn't it?
So my question is:
How can I design a custom node in such a way that when dropped on Diagram will "maintain its type" and (serializable) properties?
Till now I find out only a "fanciful way:" in the node drop event I check the SymbolPaletteItemName to decide which node the user is adding. So I can add my custom node to the model programmatically, after removing the dropped node...
I think that a best way can be used, but I don't find out it. Can you help me?

Best regards

Domenico

Domenico Mozzone
Replied On January 13, 2014 01:27 PM UTC

Hi Parthiban,
I forgot to indicate where I saw about CloneContent()
Here is the link
Best Regards
Domenico

Parthiban A [Syncfusion]
Replied On January 16, 2014 07:39 AM UTC

Hi Domenico,


This can be achieved by setting symbol palette item’s content as custom node. When symbol palette item is drag and drop from palette, by default we check the symbol palette item’s content internally. If it is node, we automatically add that node to diagram control instead of creating new node. We have modified you sample in which we had created custom node(AcGen) and set it as symbol palette item’s content. And also this custom node content is set as grid, which contains path in it. Hence when the symbol palette items is drag and drop, custom node will be added to control and having path as it content. For more information kindly refer the attached sample.


Regards,

Parthiban A.



CustomSymbols_20131223_101729Z_7346b00f_40434974.zip

Domenico Mozzone
Replied On January 16, 2014 09:17 AM UTC

Hi Pathiban,
thank you very much for your help.
It solves my request, but adding more than one custom node (AcGen), saving the xaml file, when I reload it an exception is thrown about node name duplication.
How can I workaround to avoid exception?
Best Regards
Domenico M


Parthiban A [Syncfusion]
Replied On January 21, 2014 06:12 AM UTC

Hi Domenico,

We could reproduce the reported issues. This is due to duplication value for framework "Name" property. Since Symbol palette Item’s content has same custom node, for each drag and drop operation. It will added same node to the diagram control. Hence all the node has same name in it. We have provided workaround in which, we renamed the name in loaded event. For more information kindly refer the attached sample.

Regards,

Parthiban A.



CustomSym_115088_fa166404.zip

Domenico Mozzone
Replied On January 21, 2014 08:54 AM UTC

Hi Parthiban,
than you very much for worrkaround.
Best Regards

Domenico M.

Parthiban A [Syncfusion]
Replied On January 22, 2014 05:02 AM UTC

Hi Domenico,
Thanks for your update. Please let us know if you require any further assist on this.
Regards,
Parthiban 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

;