Add an item to a specific position
Q:
How can I add an item at run time to a specific position in the list?
A:
You need to use the Insert method of the Items collection:
int position = 0; ListBoxItem item = new ListBoxItem (); item.Value = "val1"; item.Text = "text1"; ListBox1.Items.Insert(position, item);
|