Search for “UpdatesRouteDataPoints”.
Hi , no success yet im already making some sort of save for the links (old code), if i wouldnt they would all be lost would’nt they ?There is one other thing . the line becomes different than the original diagram i.e. breaks in several mid points it decides by it self , only when the next node has open links , when the only the very first node in the diagram has open links the error does’nt happen when changing the template!
Can you think of something that can cause it ?
about your question , "
Are you using the Route class for both (or all) Link DataTemplates"
how do i make sure my second template is using Route.cs ?
Thanks
i also noticed that in route.cs there are methods like ComputeMidPoint , ComputePoints .
after my points assignment (in order to keep the points location) as follows :
foreach (Link link in DiagramForPrint.Links)
{
NELink linkData = link.Data as NELink;
if (linkData == null)
{
continue;
}
link.Route.Points = linkData.Points as IList<Point>;
}
the function ComputeMidPoint hits the breakpoint again !
this haapens because of this code in Route.cs:
public Point MidPoint
{ //?? change to be DependencyProperty
get
{
if (Double.IsNaN(_MidPoint.X) || Double.IsNaN(_MidPoint.Y))
{
UpdatePoints();
<b>_MidPoint = ComputeMidPoint();</b>
}
return _MidPoint;
}
private set { _MidPoint = value; }
}
Ok , I found it !!! finally …
the last post i wrote got me to the conclusion its not right that points calculation inside Route.cs comes after my points assignment.
you see, this was my code :
void DiagramForPrint_LayoutCompleted(object sender, DiagramEventArgs e)
{
DiagramForPrint.LayoutCompleted -= DiagramForPrint_LayoutCompleted;
foreach (Link link in DiagramForPrint.Links)
{
NELink linkData = link.Data as NELink;
if (linkData == null)
{
continue;
}
link.Route.Points = linkData.Points as IList<Point>;
}
if (!IsPoligon || PrintAreaNode == null)
{
FitAll();
}
OnDiagramForPrintCompleted();
}
the reason for unregistration of the function was made because OnDiagramForPrintCompleted inits a timer , and when initialized more than once it caused problem so unregistration was the solution that time. i didnt think that Route.cs methods will continue to run after layout is complited but apperantly they are.
changed my code to this (very dumb change) :P
void DiagramForPrint_LayoutCompleted(object sender, DiagramEventArgs e)
{
foreach (Link link in DiagramForPrint.Links)
{
NELink linkData = link.Data as NELink;
if (linkData == null)
{
continue;
}
link.Route.Points = linkData.Points as IList<Point>;
}
if (!IsPoligon || PrintAreaNode == null)
{
FitAll();
}
if (!timerActivated)
{
OnDiagramForPrintCompleted();
timerActivated = true;
}
}
thanks for all the curviness help (and more) ,
and have a nice week.
Leo.