Exception Thrown in WPF Sample Project "CustomToolboxDragDrop"
courbevoie opened this issue · 1 comments
courbevoie commented
Hello!
There is, I think, a small error in the RadDiagram sample project "CustomToolboxDragDrop" (Diagram/CustomToolboxDragDrop)
In the file Example.xaml.cs in the Default_ItemSerializing
method:
void Default_ItemSerializing(object sender, SerializationEventArgs<IDiagramItem> e)
{
var shape = e.Entity as RadDiagramShape;
if (shape != null)
{
e.SerializationInfo["MyGeometry"] = shape.Geometry.ToString();
var myShape = shape.DataContext as MyShape;
if (myShape != null)
e.SerializationInfo["DataContent"] = myShape.Header;
}
}
the Geometry
of a dragged shape is serialized via ToString()
and thus the resulting path description string is apparently not in a format understood by GeometryParser
which throws an exception in RadDiagram_ShapeDeserialized
when trying to deserialize the shape.
Replacing shape.Geometry.ToString()
in the above method by GeometryParser.GetString(shape.Geometry)
resolves the problem. (The generated path description is different!)