Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic NodeCreated is not fired (Read 5852 times)
Kortexito
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: Jun 6th, 2007
NodeCreated is not fired
Apr 22nd, 2008 at 8:35am
Print Post  
Hi,

I use CustomNodeType and add my control to the diagram.Nodes collection in Drop handler. I want to set HandlesStyle to Custom, but the NodeCreated event is not fired somewhy?

P.S. I am using 1.0.0.21882 MindFusion.Diagramming.Wpf.dll version.

Best Regards.



  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: NodeCreated is not fired
Reply #1 - Apr 22nd, 2008 at 8:51am
Print Post  
Hi,

NodeCreated is raised only for items that the user draws with the mouse. You will have to assign the HandlesStyle directly to the instance variable you are using to create the node:

MyNode node = new MyNode(...);
diagram.Nodes.Add(node);
node.HandlesStyle = HandlesStyle.Custom;

If you have a lot of initialization code that you need to run both for programmatically created items and ones drawn by the user, move it to a separate method, and call the method both after using Nodes.Add() and from the NodeCreated handler.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Kortexito
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: Jun 6th, 2007
Re: NodeCreated is not fired
Reply #2 - Apr 22nd, 2008 at 9:35am
Print Post  
Hi Stoyo,

Thanks for your reply.

The problem is that my control is derived from UserControl, not from DiagramNode or ShapeNode.

Is there a way I can access a DiagramNodeAdapter created by the diagram and set its HanldesStyle property?

Best Regards.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: NodeCreated is not fired
Reply #3 - Apr 22nd, 2008 at 9:41am
Print Post  
Hi,

Yes, the adapter node is set as an attached property. After adding a WPF control to the diagram, you can get the node like this:

DiagramNodeAdapter node = diag.GetDiagramItem(wpf_control) as DiagramNodeAdapter;

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Kortexito
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 11
Joined: Jun 6th, 2007
Re: NodeCreated is not fired
Reply #4 - Apr 22nd, 2008 at 9:46am
Print Post  
Hi Stoyo,

Thank you very much.

Attaching property is the last thing I would search in, since it is so new to me and a little bit magic  Roll Eyes

Best Regards.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint