wpf - Add stack panel when check box is checked -


i want add stack panel dynamically when check box checked , if check box unchecked want remove stack panel. tried following code. when run program , check check box nothing happening.

private void bcheckbox_checked(object sender, routedeventargs e)     {         var stackpanel = new stackpanel{ orientation = orientation.vertical };         stackpanel.setvalue(grid.rowproperty, 2);         stackpanel.setvalue(grid.columnproperty, 1);          var textblockstart = new textblock { text = "loop start time", fontsize = 18,                                              margin = new thickness(20,20,0,0)};         var textboxstart = new textbox { name = "starttextbox", height=27, width=110,                                           margin = new thickness(20,10,0,0) };         var textblockend = new textblock { text = "loop end time", fontsize = 18,                                              margin = new thickness(20,20,0,0)};         var textboxend = new textbox { name = "endtextbox", height=27, width=110,                                          margin = new thickness(20,10,0,0) };          stackpanel.children.add(textblockstart);         stackpanel.children.add(textboxstart);         stackpanel.children.add(textblockend);         stackpanel.children.add(textboxend);      } 

what can create stackpanel in xaml markup visibility set collapsed , toggle visibility of stackpanel on check event of checkbox


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -