I am trying to draw lines between buttons inside two different wrap panel
..This has to happen on click of button .The partial code goes below.
UserControlButton btn = (UserControlButton)sender;
WrapPanel parentPanel = VisualTreeHelper.GetParent(btn) as WrapPanel;
Point position = Mouse.GetPosition(parentPanel);
Point startPosition = new Point();
Point endPosition = btn.PointToScreen(position);
startPosition.X = endPosition.X - position.X;
startPosition.Y = endPosition.Y;
Line line = DrawLine(endPosition, startPosition, Brushes.Red);
The first problem is Mouse.GetPosition(parentPanel); it is not returning
posistion with respect to wrap panel.
|