Every time you move an item up or down a listBox
it loses the focus of the item.
I can not always focus on the item.
For example: suppose my list has 200 items. So I want to move the item that is in position 160 to the 159, so once moved it loses its selection (focus), if you want to move from 159 to 158 I will have to click on the item again and select.
public void MoveItem(int direction)
{
if (listBox.SelectedItem == null || listBox.SelectedIndex < 0)
return;
int newIndex = listBox.SelectedIndex + direction;
if (newIndex < 0 || newIndex >= listBox.Items.Count)
return;
object selected = listBox.SelectedItem;
listBox.Items.Remove(selected);
listBox.Items.Insert(newIndex, selected);
}