When I create my shapes, I'm changing the style of the Connections to look like the first image where they say "True" and "False". The function CreateTrueConnection shows the properties I'm setting. When I save and then reload the diagram it looks like the 2nd picture, which only retains the green and red colors, but none of the other styling and more importantly NOT the Name property, which I use in function GetTrueTargetRow to figure out my workflow in code. How do I serialize that information into the diagram so it will reload the same way?
public
static
void
CreateTrueConnection(RadDiagram Diagram, RadDiagramShape Shape, String Label =
""
)
{
RadDiagramConnection tc =
new
RadDiagramConnection();
tc.Stroke = Brushes.Green;
tc.StrokeThickness = 2;
tc.AllowDelete =
true
;
((Telerik.Windows.Diagrams.Core.IDiagramItem)tc).Name =
"TrueConnection"
;
tc.SourceConnectorPosition = Telerik.Windows.Diagrams.Core.ConnectorPosition.Bottom;
tc.ConnectionType = Telerik.Windows.Diagrams.Core.ConnectionType.Polyline;
tc.StartPoint =
new
Point(Shape.Connectors[
"Bottom"
].AbsolutePosition.X, Shape.Connectors[
"Bottom"
].AbsolutePosition.Y);
tc.EndPoint =
new
Point(Shape.Connectors[
"Bottom"
].AbsolutePosition.X, Shape.Connectors[
"Bottom"
].AbsolutePosition.Y + 100);
tc.TargetCapType = Telerik.Windows.Diagrams.Core.CapType.Arrow2Filled;
tc.Source = Shape;
// Add the "True" Label
if
(Label !=
""
)
{
System.Windows.Controls.Border brdr =
new
System.Windows.Controls.Border();
System.Windows.Controls.Label lbl =
new
System.Windows.Controls.Label();
lbl.Background = Brushes.Green;
lbl.Foreground = Brushes.White;
lbl.FontWeight = FontWeights.Bold;
lbl.HorizontalContentAlignment = HorizontalAlignment.Center;
lbl.Content = Label;
brdr.BorderBrush = Brushes.DarkGreen;
brdr.BorderThickness =
new
Thickness(2.0);
brdr.CornerRadius =
new
CornerRadius(3.0);
brdr.Child = lbl;
tc.Content = brdr;
}
Diagram.AddConnection(tc);
}
public
static
dsdSteps.BIEFlowchartStepRow GetTrueTargetRow(dsdSteps StepData, IShape Shape)
{
dsdSteps.BIEFlowchartStepRow trueTargetRow =
null
;
foreach
(var con
in
Shape.OutgoingLinks)
{
//|| ((RadDiagramConnection)con).Stroke == Brushes.Green <-- Tried looking at the connection color to know if it's true etc... didn't work
if
((con.Name ==
"TrueConnection"
|| con.Name ==
"StartConnection"
) && con.Target !=
null
)
{
trueTargetRow = (from x
in
StepData.BIEFlowchartStep
where x.GUID == ((RadDiagramShape)con.Target).Id
select x).FirstOrDefault();
}
}
return
trueTargetRow;
}