ShapeSerialized never called?

4 posts, 0 answers
  1. Kristoffer
    Kristoffer avatar
    158 posts
    Member since:
    Dec 2012

    Posted 07 Feb 2013 Link to this post

    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"]);
    }

  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 12 Feb 2013 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Kristoffer
    Kristoffer avatar
    158 posts
    Member since:
    Dec 2012

    Posted 12 Feb 2013 Link to this post

    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! :)
  5. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 15 Feb 2013 Link to this post

    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.

Back to Top