Problem with serialization

Hi! I’m trying to serialize my diagram but i’m facing some troubles when a load it because the shapes of my nodes disappear (are replaced by text, something like “PartManager.PartBinding of Node to 2”)
I looked at samples to find the reason but i can’t. I saw that is necessary to override the methods MakeXElement and LoadFromXElement but i don’t have any properties to add to them. My node class has some child classes each one pointing to a different dataTemplate on a DataTemplateDictionary (each dataTemplate specifies a different node shape in Xaml). Can you help me please? Thanks

Sounds like you have a “{Binding Path=Property}” rather than a “{Binding Path=Data.Property}”.

Hi Walter. I solved the problem of the shapes but now i’m facing another problem! I write in a previous post that my
BaseNode class has some child classes. So i override the MakeXElement and LoadFromXElement methods in each child class. When i press the button to save the model it works fine, executes all MakeXElement methods on all subclasses and generates a XML file with all attributes that are necessary, but when i make the load of the XML file only the override method LoadFromXElement from the
BaseNode class is executed and only its properties values are recovered. I think the problem is that when i load the XML file i define that i will only load the BaseNode class and the BaseLink class because i write (model.Save<BaseNode, BaseLink> and model.Load<BaseNode, BaseLink> ). The question is how can i load the properties of the child classes of the BaseNode class? Thanks for your support.

Use the other Load method, overloaded to take functions where you can decide what objects to create.

There are another load method? I’m not sure how can i do that overload.
Can you give me an example or some steps to guide me? Thanks

The Piping sample demonstrates the use of the other model.Load method:

<font size="2" face="Consolas"><font size="2" face="Consolas">model.Load<ItemData, PipeData>(root, AllocateItemData, AllocatePipeData);

Thanks Walter. I follow the example you suggested and i solved the problem. But i have another problem now :) on my LinkClass i have two variables that instantiate nodeClasses. I try to follow the LogicCircuit example and use e.Add(XHelper.AttributeEnum(“XXX”, this.XXX, XXX)) command to pass all the object but its not working until now. How can i save an entire object, in this case a NodeClass object? Thanks

I’m not sure what your data is. At this point it’s just a matter of Linq for XML code, so you should be able to do whatever you need. We defined the XHelper class for convenience and for standardization, but you don’t need to use anything there.

I was thinking wrong this problem Walter. In fact i was trying to do operations in data classes that should be done on model class. Thanks for you support. It’s working fine now