Button addButton = new Button(); Panel panel = new Panel(); addButton.Click += (sender, args) => { TextBlock newText = new TextBlock(); newText.Text = "New Text Block"; panel.Children.Add(newText); };
Button addButton = new Button(); Grid grid = new Grid(); addButton.Click += (sender, args) => { RowDefinition newRow = new RowDefinition(); grid.RowDefinitions.Add(newRow); };Package Library: System.Windows.Controls.