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.
UserControlButt on btn = (UserControlBut ton)sender;
WrapPanel parentPanel = VisualTreeHelpe r.GetParent(btn ) as WrapPanel;
Point position = Mouse.GetPositi on(parentPanel) ;
Point startPosition = new Point();
Point endPosition = btn.PointToScre en(position);
startPosition.X = endPosition.X - position.X;
startPosition.Y = endPosition.Y;
Line line = DrawLine(endPos ition, startPosition, Brushes.Red);
The first problem is Mouse.GetPositi on(parentPanel) ; it is not returning
posistion with respect to wrap panel.
..This has to happen on click of button .The partial code goes below.
UserControlButt on btn = (UserControlBut ton)sender;
WrapPanel parentPanel = VisualTreeHelpe r.GetParent(btn ) as WrapPanel;
Point position = Mouse.GetPositi on(parentPanel) ;
Point startPosition = new Point();
Point endPosition = btn.PointToScre en(position);
startPosition.X = endPosition.X - position.X;
startPosition.Y = endPosition.Y;
Line line = DrawLine(endPos ition, startPosition, Brushes.Red);
The first problem is Mouse.GetPositi on(parentPanel) ; it is not returning
posistion with respect to wrap panel.