Hi
With release .Net version 4.0 of wpf diagram, we have overrided the OnPositionChanged to prevent the user to move the chart to the left and upward compared to the position (0,0). If the coordinates of the diagram exceed the point of origin, the position is reset to the origin point. Ex.: (10, -10) is converted into (0, -10).
We have updated our solution with the beta 4.5 and the behavior has changed. It is impossible to change the Position property of the diagram in the method "OnPositionChanged."
I attache a sample project. The source code is in the class "MyDiagram." Download project here
Could you restore the original behavior or offer a solution?
Sincerely,
With release .Net version 4.0 of wpf diagram, we have overrided the OnPositionChanged to prevent the user to move the chart to the left and upward compared to the position (0,0). If the coordinates of the diagram exceed the point of origin, the position is reset to the origin point. Ex.: (10, -10) is converted into (0, -10).
We have updated our solution with the beta 4.5 and the behavior has changed. It is impossible to change the Position property of the diagram in the method "OnPositionChanged."
I attache a sample project. The source code is in the class "MyDiagram." Download project here
Could you restore the original behavior or offer a solution?
Sincerely,
protected
override
void
OnPositionChanged(Point oldPosition, Point newPosition)
{
base
.OnPositionChanged(oldPosition, newPosition);
Point newPoint = newPosition;
if
(newPosition.X > 0)
{
newPoint.X = 0;
}
if
(newPosition.Y > 0)
{
newPoint.Y = 0;
}
//With the 4.0 DLL version, there is no problem to set the new position
if
(newPoint != newPosition)
{
this
.Position = newPoint;
}
if
(newPoint != newPosition)
{
//With the 4.5 DLL version, I need to invoke the method to get the same behaviour
//but the diagram flikers
Dispatcher.BeginInvoke(
new
Action(() =>
{
this
.Position = newPoint;
}), DispatcherPriority.Render);
}
sh.SetText(((
int
)
this
.Position.X).ToString(
""
) +
" - "
+ ((
int
)
this
.Position.Y).ToString(
""
));
}
}