using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace WpfControl2 { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); System.Windows.Controls.Button nButton = new Button(); nButton.Content = "simple button"; nButton.Height = 40; nButton.Width = 100; nButton.Click += new RoutedEventHandler(Click_Me); nButton.BorderBrush = Brushes.Maroon; grid1.Children.Add(nButton); } public void Click_Me(object sender, RoutedEventArgs e) { System.Windows.Controls.Label L1 = new Label(); L1.Height = 40; L1.Width = 350; L1.Content = "You said it"; grid2.Children.Add(L1); label1.Content = "I got stuck in Grid 1 By Design"; } } }