I have b Buttons
created dynamically by code and I want to draw a Line
between the first node and the last in the same StackPanel
. The problem is that whenever I call this function it doesn't make the line from the first to the b Button
but instead it move the line to the right.
My code for the Line
draw function:
public void CreateALine()
{
redLine = new Line();
redLine.X1 = nodul_nou[0].Margin.Left ;
redLine.Y1 = nodul_nou[b].Margin.Top - 40;
redLine.X2 = nodul_nou[b].Margin.Left ;
redLine.Y2 = nodul_nou[b].Margin.Top - 40;
SolidColorBrush redBrush = new SolidColorBrush();
redBrush.Color = Colors.Black;
redLine.StrokeThickness = 4;
redLine.Stroke = redBrush;
workplace.Children.Add(redLine);
}
Note:
nodul_nou[b]
is the Button
I am speak about, It does not draw a line between the first Button
, nodul_nou[0]
, and the b Button
, nodul_nou[b]
.