Is it possible to add Controls via a loop to a Control? The difficulty is the name: it is the same in each circulation, so I get only one Control named hu and not 10. How can I modify the code to get 10 Borders?
for (int i = 0; i < 10; i++)
{
Border hu = new Border();
hu.Width = 10;
hu.Height = 10;
hu.Margin = new Thickness(10 * i);
hu.Background = (Brush) typeof(Brushes).GetProperty(Felder[i]).GetValue(null, null);
mastergrid.Children.Add(hu);
}