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

Save and Load Problem

2 Answers 96 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 22 May 2014, 12:09 PM
Hi,

I try to save a diagram where a add some custom connectors on each shape. Also I add a custom tabcontent for each shape.
The Problem after saving and reloading it from XML, all my custom connectors a my tabcontent are away. How can I save
my logic in the XML too?

Thanks
Best Regards
Rene

2 Answers, 1 is accepted

Sort by
0
ITA
Top achievements
Rank 1
answered on 22 May 2014, 12:17 PM
Hi,

sorry this is my saved XML-File
<?xml version="1.0" encoding="utf-8"?>
<RadDiagram Version="2013.1">
  <Metadata Type="Telerik.Windows.Controls.RadDiagram" Id="87cf0c87-8d76-40dc-8e86-9b08f47f90e1" Zoom="1" IsSnapEnabled="true" SnapX="20" SnapY="20">
    <Title>Diagram [22.05.2014 13:44:16]</Title
    ><Description></Description>
  </Metadata><Groups />
  <Shapes QNs="Telerik.Windows.Controls.Diagrams, Version=2013.1.403.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7;">
    <RadDiagramShape Type="Telerik.Windows.Controls.RadDiagramShape" Id="2d16f1bd-5d36-442c-b86c-18f0341245e9" ZIndex="2" Position="440;328" Content="Condition" Background="#FF23A0DA" Foreground="#FFFFFFFF" Size="80;80" RotationAngle="0" MinWidth="0" MinHeight="0" MaxWidth="INF" MaxHeight="INF" Connectors="InConnectorIf1:0.5;0,InConnectorIf2:0.5;1,InConnectorIf3:1;0.5,InConnectorIf4:0;0.5," UseDefaultConnectors="False" Geometry="M56,0.5L111.5,37.5 56,74.5 0.5,37.5z" QN="0" />
    <RadDiagramShape Type="Telerik.Windows.Controls.RadDiagramShape" Id="af831e1c-8c87-4ecb-a4d2-f61049bb9483" ZIndex="2" Position="540;93" Content="Statement" Background="#FFF1C700" Foreground="#FFFFFFFF" Size="80;40" RotationAngle="0" MinWidth="0" MinHeight="0" MaxWidth="INF" MaxHeight="INF" Connectors="InConnectorS1:0.5;0.3,InConnectorS2:0.5;0.6," UseDefaultConnectors="False" Geometry="M0.5,0.5L111.5,0.5 111.5,74.5 0.5,74.5z" QN="0" />
    <RadDiagramShape Type="Telerik.Windows.Controls.RadDiagramShape" Id="d23ebbc2-80d6-4cc5-923c-ded800907244" ZIndex="2" Position="150;93" Content="Start" Background="#FF319B47" Foreground="#FFFFFFFF" Size="50;50" RotationAngle="0" MinWidth="0" MinHeight="0" MaxWidth="INF" MaxHeight="INF" Connectors="StartConncetor:0.5;1," UseDefaultConnectors="False" Geometry="M111.5,37.5C111.5,57.91 86.67,74.5 56,74.5 25.33,74.5 0.5,57.91 0.5,37.5 0.5,17.09 25.33,0.5 56,0.5 86.67,0.5 111.5,17.09 111.5,37.5z" QN="0" />
    <RadDiagramShape Type="Telerik.Windows.Controls.RadDiagramShape" Id="a26160d8-a9c9-4b6e-bfa1-1e2221609326" ZIndex="2" Position="920;358" Content="End" Background="#FFFF1117" Foreground="#FFFFFFFF" Size="50;50" RotationAngle="0" MinWidth="0" MinHeight="0" MaxWidth="INF" MaxHeight="INF" Connectors="InConnectorE1:0.5;1,InConnectorE2:1;0.5,InConnectorE3:0;0.5,InConnectorE4:0.5;0," UseDefaultConnectors="False" Geometry="M111.5,37.5C111.5,57.91 86.67,74.5 56,74.5 25.33,74.5 0.5,57.91 0.5,37.5 0.5,17.09 25.33,0.5 56,0.5 86.67,0.5 111.5,17.09 111.5,37.5z" QN="0" />
  </Shapes>
  <Connections QNs="Telerik.Windows.Controls.Diagrams, Version=2013.1.403.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7;">
    <RadDiagramConnection Type="Telerik.Windows.Controls.RadDiagramConnection" Id="fe1cc817-23dd-498b-b0f0-dacdb23acf14" ZIndex="1" Position="175;105" IsRotationEnabled="false" IsResizingEnabled="false" SourceConnectorPosition="StartConncetor" TargetConnectorPosition="InConnectorS1" SourceCapType="None" TargetCapType="None" SourceCapSize="7;7" TargetCapSize="7;7" StartPoint="175;143" Source="d23ebbc2-80d6-4cc5-923c-ded800907244" EndPoint="580;105" Target="af831e1c-8c87-4ecb-a4d2-f61049bb9483" ConnectionType="Polyline" ConnectionPoints="" QN="0" />
    <RadDiagramConnection Type="Telerik.Windows.Controls.RadDiagramConnection" Id="816a429b-f5cd-478d-bcb0-c1f8b6f830c7" ZIndex="1" Position="480;117" IsRotationEnabled="false" IsResizingEnabled="false" SourceConnectorPosition="InConnectorS2" TargetConnectorPosition="InConnectorIf1" SourceCapType="None" TargetCapType="None" SourceCapSize="7;7" TargetCapSize="7;7" StartPoint="580;117" Source="af831e1c-8c87-4ecb-a4d2-f61049bb9483" EndPoint="480;328" Target="2d16f1bd-5d36-442c-b86c-18f0341245e9" ConnectionType="Polyline" ConnectionPoints="" QN="0" />
    <RadDiagramConnection Type="Telerik.Windows.Controls.RadDiagramConnection" Id="0b212d27-3875-4e9f-b61d-f1a8112647a8" ZIndex="1" Position="520;368" IsRotationEnabled="false" IsResizingEnabled="false" SourceConnectorPosition="InConnectorIf3" TargetConnectorPosition="InConnectorE3" SourceCapType="None" TargetCapType="None" SourceCapSize="7;7" TargetCapSize="7;7" StartPoint="520;368" Source="2d16f1bd-5d36-442c-b86c-18f0341245e9" EndPoint="920;383" Target="a26160d8-a9c9-4b6e-bfa1-1e2221609326" ConnectionType="Polyline" ConnectionPoints="" QN="0" />
    <RadDiagramConnection Type="Telerik.Windows.Controls.RadDiagramConnection" Id="74cde8da-7960-404d-b684-8850fa30ce7f" ZIndex="1" Position="480;408" IsRotationEnabled="false" IsResizingEnabled="false" SourceConnectorPosition="InConnectorIf2" TargetConnectorPosition="InConnectorE1" SourceCapType="None" TargetCapType="None" SourceCapSize="7;7" TargetCapSize="7;7" StartPoint="480;408" Source="2d16f1bd-5d36-442c-b86c-18f0341245e9" EndPoint="945;408" Target="a26160d8-a9c9-4b6e-bfa1-1e2221609326" ConnectionType="Polyline" ConnectionPoints="" QN="0" />
    <RadDiagramConnection Type="Telerik.Windows.Controls.RadDiagramConnection" Id="49ed0633-6410-4de0-8fa5-fa82ddf0fcb1" ZIndex="1" Position="440;358" IsRotationEnabled="false" IsResizingEnabled="false" SourceConnectorPosition="InConnectorIf4" TargetConnectorPosition="InConnectorE4" SourceCapType="None" TargetCapType="None" SourceCapSize="7;7" TargetCapSize="7;7" StartPoint="440;368" Source="2d16f1bd-5d36-442c-b86c-18f0341245e9" EndPoint="945;358" Target="a26160d8-a9c9-4b6e-bfa1-1e2221609326" ConnectionType="Polyline" ConnectionPoints="" QN="0" />
  </Connections>
</RadDiagram>

As you can see there is a Shape with one outgoing Conncetor, but after loading this xml-File the logic of the connectors is not working any more.

Thanks
Rene
0
Accepted
Milena
Telerik team
answered on 26 May 2014, 11:12 AM
Hi Rene,

Thank you for the xml code snippet provided. 

You can find more information about how to Save the Diagram in the File System in our help article. For your convenience I implemented this approach in the attached project, where I use custom diagram items. Please take a look at it and let me know if it works for you. 

Also, please have in mind that when you save a diagram to file,  by default only a predefined set of properties is serialized. If you want to save and load custom properties you can handle the ShapeSerialized and ShapeDeserialized events of the diagram. You can take a look at the Serialization help article which demonstrates saving custom properties. 

I hope this information will help you.

Regards,
Milena
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Diagram
Asked by
ITA
Top achievements
Rank 1
Answers by
ITA
Top achievements
Rank 1
Milena
Telerik team
Share this question
or