winforms - how to add multiple comboboxes to the listbox dynamically in C# -
i trying add comboboxes + text list box dynamically in c# has display 2 comboboxes + text, showing text if written
lstboxvideos.item.add(subvideo)
and showing 1 combobox if written
lstboxvideos.controls.add(subvideo)
suggest me how problem
foreach(var video in videos) { var subvideos = video.descendants("subvideos"); if (subvideos.count() >= 1) { combobox subvideo = new combobox(); subvideo.name = "subvideo" + i; subvideo.items.add(video.attribute("name").value); foreach(var videoname in subvideos) { subvideo.items.add(videoname.value); } listboxvideos.items.add(subvideo); i++; } else { listboxvideos.items.add(video.attribute("name").value); } }
you can add them this:
var cb = new combobox(); var t1 = new textblock(){text = "111"}; var t2 = new textblock(){text = "222"}; var t3 = new textblock(){text = "333"}; cb.items.add(t1); cb.items.add(t2); cb.items.add(t3); yourlistbox.items.add(cb);
Comments
Post a Comment