2,854 questions
I think it like this:
private void AddControls()
{
TextBlock textBlock1 = new TextBlock { Text = "Text 1", Width = 100, Height = 25};
TextBlock textBlock2 = new TextBlock { Text = "Text 2", Width = 100, Height = 25 };
StackPanel stackPanel = new StackPanel();
stackPanel.Children.Add(textBlock1);
stackPanel.Children.Add(textBlock2);
Button button = new Button { Width = 250, Height = 60 };
button.Content = stackPanel;
gridMain.Children.Add(button);
}