WPF Listbox with checkboxes appearing blank, added dynamically

Posted by wonea on Stack Overflow See other posts from Stack Overflow or by wonea
Published on 2010-05-05T16:26:01Z Indexed on 2010/05/05 16:28 UTC
Read the original article Hit count: 176

Filed under:
|
|
|

I'm trying to populate a listbox with a series checkbox entries, however once running the code below the listbox has blank entries in it, which are selectable, i.e. a blue bar appears. However neither the text or checkbox appears.

for (int num = 1; num <= 10; num++)
{
   CheckBox checkBox = new CheckBox();
   checkBox.Text = "sheet" + num.ToString();
   checkBox.Name = "checkbox" + num.ToString();

   thelistbox.Items.Add(checkBox);
}

© Stack Overflow or respective owner

Related posts about wpf

Related posts about c#