我以编程方式在包装面板内制作了一个边框,但现在我需要在该边框中添加 2 个标签。我怎样才能以编程方式做到这一点

I have made a border inside of a wrap panel programatically, but now I need to add 2 label into that border. How can I do that programatically as well

所以目前我有这个:

for (int i = 0; i < 100; i++)
        {
            WrapPanel.Children.Add(new Border { Background = (Brush)bc.ConvertFrom("#C7DFFC"), Margin = new System.Windows.Thickness(5, 5, 5, 5), Height = 50, Width = 50, Name = ("RAM" + i) });
        }

这在我的 WrapPanel 中创建了 100 个边框。现在我需要在每个边框中创建 2 个标签。我该怎么做?

Border border = new Border();
StackPanel panel = new StackPanel();
//add child controls like labels etc
panel.Children.Add(child1);
panel.Children.Add(child2);
//set the panel as child of border
border.Child = panel;
//nod add border to 
WrapPanel.Children.Add(border);