Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Custom nodes doesn't retain the properties (Read 3976 times)
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Custom nodes doesn't retain the properties
Oct 19th, 2010 at 9:35am
Print Post  
hi,

I have created a custom control & added this control as a node to the diagram. And this custom controls has various properties like Id, Name, Type..
Diagram to be saved as a String & when i re-load the diagram with the saved string i can able to see my custom control in the diagram area. But values assigned to the property 'Id' ony is not retained, but for other properties i can see the values which was assigned earlier.

Can any one help me please?
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom nodes doesn't retain the properties
Reply #1 - Oct 19th, 2010 at 10:11am
Print Post  
Hi,

Does that property provide a public setter? Hosted controls are saved using th WPF's XamlWriter class, and I suppose it only handles public properties. You could also handle the SerializeControl and DeserializeControl events to implement your own serializaton code.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Custom nodes doesn't retain the properties
Reply #2 - Oct 19th, 2010 at 10:14am
Print Post  
Hi,
property is "Public" only.

[You could also handle the SerializeControl and DeserializeControl events to implement your own serializaton code.]

How to serialize & de-serialize?
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom nodes doesn't retain the properties
Reply #3 - Oct 19th, 2010 at 10:17am
Print Post  
There is some sample code showing that in the SerializeControl help topic linked above.
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Custom nodes doesn't retain the properties
Reply #4 - Oct 19th, 2010 at 10:48am
Print Post  
But my requirement is, when i select/clik the node that time i need to access the property of my custom node.
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom nodes doesn't retain the properties
Reply #5 - Oct 19th, 2010 at 1:57pm
Print Post  
Hi,

To access the properties of a clicked control, in the NodeClicked handler typecast e.Node to DiagramNodeAdapter, and then adapter.UIElement to your control type.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
venki5star
Junior Member
**
Offline



Posts: 82
Location: India
Joined: Mar 9th, 2010
Re: Custom nodes doesn't retain the properties
Reply #6 - Oct 20th, 2010 at 3:13am
Print Post  
Yes i'm doing the same. But only for few properties(Id.) values are not retained.
  

Castle Rider
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom nodes doesn't retain the properties
Reply #7 - Oct 20th, 2010 at 6:13am
Print Post  
They might get changed after the diagram is loaded - try running with a breakpoint on the Id setter to see if that's what happens. Otherwise you can't do much if XamlReader does not load correct Ids, except to implement custom serialization.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint