C# Programming
03-28-2009, 04:32 AM
Hello, I have populated my WPF listbox from c# code like this:
private void button1_Click(object sender, RoutedEventArgs e)
{ listbox1.Items.Add("blah"); }
Well, the items appear in the listbox, but I CAN'T SELECT THEM INDIVIDUALLY. I've also found that the "index" property is the same for each item.
However, if I populate the listbox from XAML, it works PERFECTLY: selection is OK, indexes are different.
What's wrong with my code?
private void button1_Click(object sender, RoutedEventArgs e)
{ listbox1.Items.Add("blah"); }
Well, the items appear in the listbox, but I CAN'T SELECT THEM INDIVIDUALLY. I've also found that the "index" property is the same for each item.
However, if I populate the listbox from XAML, it works PERFECTLY: selection is OK, indexes are different.
What's wrong with my code?