This is a migrated thread and some comments may be shown as answers.

ShapeSerialized never called?

3 Answers 77 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Kristoffer
Top achievements
Rank 1
Kristoffer asked on 07 Feb 2013, 03:41 PM
XAML:
ShapeSerialized="diagram_ShapeSerialized"

Code-behind:
private void diagram_ShapeSerialized(object sender, ShapeSerializationRoutedEventArgs e)
{
    // Event not working?!
    System.Diagnostics.Debugger.Break();
}

My ShapeSerialized handler is never called! What could be wrong? Note that I do have a custom shape, derived from RadDiagramShape.

Update
Please note that I have overridden the serialization methods of my shape. Makes no difference...

public override Telerik.Windows.Diagrams.Core.SerializationInfo Serialize()
{
    var info = base.Serialize();

    info["IsResizingEnabled"] = IsResizingEnabled;
    info["IsRotationEnabled"] = IsRotationEnabled;
    info["ZIndex"] = ZIndex;

    return info;
}

public override void Deserialize(Telerik.Windows.Diagrams.Core.SerializationInfo info)
{
    base.Deserialize(info);

    IsResizingEnabled = Convert.ToBoolean(info["IsResizingEnabled"]);
    IsRotationEnabled = Convert.ToBoolean(info["IsRotationEnabled"]);
    ZIndex = Convert.ToInt32(info["ZIndex"]);
}

3 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 12 Feb 2013, 02:40 PM
Hi Kristoffer,

I tried to reproduce your issue with our latest official release (2012.3.1129) but it seems that the code works as expected on our side. Please keep in mind that when the RadDiagram.Save() method is used, the ShapeSerialized event is invoked for each shape separately and Serialized event is invoked for the RadDiagram control only once. Please take a look at this article and make sure that you follow the described approach. You can also take a look at the attached project and let me know if it works for you.

Kind regards,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Kristoffer
Top achievements
Rank 1
answered on 12 Feb 2013, 02:50 PM
Thanks.
I expected this event to fire when dropping shapes too. It doesn't, and probably shouldn't.

However, it's very painful that your documentation never helps out in these situations. E.g.:
http://www.telerik.com/help/wpf/e_telerik_windows_controls_raddiagram_shapeserialized.html
"Occurs when a shape has been serialized."  - you don't say...

I hate to say this, but large parts of the documentation are worthless. Your help in the forums is awesome, but every time we run into an issue we pretty much rely on a direct answer from you. Please spend some more time on your auto-generated documentation! :)
0
Pavel R. Pavlov
Telerik team
answered on 15 Feb 2013, 04:13 PM
Hi Kristoffer,

We are now revising the documentation regarding the RadDiagram control and new articles will be available with the new official release (till the end of February). However, please note that in order to get more descriptive information and examples, you need to examine the RadDiagram documentation instead of the API documentation.

Let me now get back to your question. The Drag/Drop serialization depends on your drag and drop logic (how it is implemented) and where you drop from. If you need to understand why this event is not invoked in your case, you can send me your project and I will explain to you what is happening and if the shape is expected to be serialized.

Looking forward to hearing from you.

All the best,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Diagram
Asked by
Kristoffer
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Kristoffer
Top achievements
Rank 1
Share this question
or