private void btn_Click(object sender, EventArgs e) { DemoPage panelActiveDemo = null; switch ((sender as Button).Text) { //case "Panel": panelActiveDemo = new PanelDemo(); break; //case "Checkbox": panelActiveDemo = new CheckboxDemo(); break; case "Image": panelActiveDemo = new ImageDemoPage(); break; case "Level": panelActiveDemo = new LevelDemoPage(); break; //case "Slider": panelActiveDemo = new SliderDemo(); break; case "ProgressBar": panelActiveDemo = new ProgressBarDemoPage(); break; } if (panelActiveDemo != null) { //DemoManager.Desktop.Children.Add(panelActiveDemo); //DemoManager.Desktop.Invalidate(); Children.Add(panelActiveDemo); } }