The fact is that ListBox.Items
is a plain object collection and returns plain untyped objects, which cannot be multi-selected (by default).
If you want to multi-select all items, then this will work:
for (int i = 0; i < myListBox.Items.Count;i++)
{
myListBox.SetSelected(i, true);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…