this is function to make line with 4 points that give it place and name
int counter=0;
public void CreateALine(double po1, double po2, double po3, double po4)
{
// Create a Line
Line redLine = new Line();
redLine.X1 = po1;
redLine.Y1 = po2;
redLine.X2 = po3;
redLine.Y2 = po4;
// Create a red Brush
SolidColorBrush redBrush = new SolidColorBrush();
redBrush.Color = Colors.Red;
// Set Line's width and color
redLine.StrokeThickness = 3;
redLine.Stroke = redBrush;
// Add line to the Grid.
LayoutRoot.Children.Add(redLine);
LayoutRoot.RegisterName("readline"+counter, redLine);
counter++;
}
I want to create more than one line, Could i access to any line by its name? to make an event or control its Visibility like this :
redline0.Visibility = Visibility.Collapsed;
redline1.Visibility = Visibility.Visible;