private void Up(object sender, RoutedEventArgs e) { int index = Lb_Apps.SelectedIndex; if (index > 0) { Appconf tmp1 = al[index]; Appconf tmp2 = al[index - 1]; al.RemoveAt(index, false); al.Insert(index, tmp2); al.RemoveAt(index - 1, false); al.Insert(index - 1, tmp1); Lb_Apps.Items.RemoveAt(index); Lb_Apps.Items.Insert(index, al[index].AppName); Lb_Apps.Items.RemoveAt(index - 1); Lb_Apps.Items.Insert(index - 1, al[index - 1].AppName); Lb_Apps.SelectedIndex = index - 1; } }