Question about RadDiagramShape Content Serialization

4 posts, 0 answers
  1. Jiaqi
    Jiaqi avatar
    6 posts
    Member since:
    Nov 2011

    Posted 03 Aug 2012 Link to this post


    I am a beginner of dev and have a question about RadDiagramShape content serialization.
    if RadDiagramShape content includes some controls (for example:stackpanel image,textblock) ,how to serializate it?

    RadDiagram.Save() and RadDiagram.Load() couldn't   serialize shape content!

    Thanks in advanced!

  2. Alex Fidanov
    Alex Fidanov avatar
    637 posts

    Posted 03 Aug 2012 Link to this post


     The diagram will not serialize any UIElement or business object set as content of the diagram item. Moreover, we are only serializing string objects. If you want to serialize the content, you have to do it manually using the ShapeSerialized and ShapeDeserialized events. You can see how to do this in our online help article here.

    Kind regards,
    Alex Fidanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Kidder
    Kidder avatar
    13 posts
    Member since:
    Nov 2012

    Posted 07 Dec 2012 Link to this post

    I couldnt work this example on your article.

      void diagram_ShapeDeserialized(object sender, Telerik.Windows.Controls.Diagrams.ShapeSerializationRoutedEventArgs e)
                // load the saved property
                (e.Shape as RadDiagramShape).Opacity = Convert.ToDouble(e.SerializationInfo["Opacity"], CultureInfo.InvariantCulture);

            void diagram_ShapeSerialized(object sender, Telerik.Windows.Controls.Diagrams.ShapeSerializationRoutedEventArgs e)
                // save custom or other property
                e.SerializationInfo["Opacity"] = (e.Shape as RadDiagramShape).Opacity.ToInvariant();


    It gives below errors:
    Error17'double' does not contain a definition for 'ToInvariant' and no extension method 'ToInvariant' accepting a first argument of type 'double' could be found (are you missing a using directive or an assembly reference?)

    Please send me an working example..
  4. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 12 Dec 2012 Link to this post

    Hello Kidder,

    Thank you for bringing this issue to our attention.

    The Double.ToInvariant() extension method is defined in the Telerik.Windows.Diagrams.Core namespace and you need to add a using statement for it:
    using Telerik.Windows.Diagrams.Core;

    I attached a sample solution based on the Serialization article content. And I will update the content of the article to note the using statement as soon as possible.

    All the best,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top