1- What I have:
I applied same example in here http://www.telerik.com/help/wpf/raddiagram-extensions-toolbox.html
the content of myShape is an image (I dnt have a geometry) when I drop it into RadDiagram it generates new instance of one of my custom classes in deserialization. I'm doing that by serializing the Header
which is the hint key for me in deserializtion for generating the right custom class for the dropped shape.
void diagram_ShapeSerialized(object sender, SerializationEventArgs<IDiagramItem> e)
var shape = e.Entity as RadDiagramShape;
if (shape != null)
var myShape = shape.DataContext as GalleryItem;
if (myShape != null)
e.SerializationInfo["DataContent"] = myShape.Header;
private void RadDiagram_ShapeDeserialized(object sender, ShapeSerializationRoutedEventArgs e)
var shape = e.Shape as RadDiagramShape;
if (shape != null)
shape.Content = e.SerializationInfo["DataContent"].ToString();
shape.Content = new MyTimeChart(); break;
shape.Content = new MyTimeValue(); break;
2- What I need:
When I save the Diagram by owner.fileManager.SaveToFile();
I can't find inside the xml file the Content property or any SerializationInfo that's mean nothing could be serialized! I added this line
e.SerializationInfo["Content"] = myShape.Header;
in Serialization Event and still the same
I need to retrieve the same Design the user will make!
In Debug mode
, Saving doesn't hit the Serialization Event >>> that's mean it depends on the first serialization!
While it hits DeSerialization Event when I'm dropping the shape and when I'm loading the xml
And in Loading file time It always breaks inside DeSerialization Event at
shape.Content = e.SerializationInfo[
].ToString();<br> shape.Content = e.SerializationInfo[
and says "Object reference not set to an instance of an object"!
I need help! I thought a loooot of solutions but I nothings worked! Reply me please ASAP!