diff --git a/ViewModels/ExperimentLogViewModel.cs b/ViewModels/ExperimentLogViewModel.cs --- a/ViewModels/ExperimentLogViewModel.cs +++ b/ViewModels/ExperimentLogViewModel.cs @@ -135,7 +135,10 @@ namespace DesertPaintCodex.ViewModels { int oldPos = list.IndexOf(test); - if (((oldPos > 0) || (test.CompareTo(list[oldPos - 1]) > 0)) + // If the item is first in the list or the previous item is valued < the test + // And either the item is last in the list or the next item in the list is valued > than the item + // Don't move it + if (((oldPos == 0) || (test.CompareTo(list[oldPos - 1]) > 0)) && ((oldPos == list.Count - 1) || (test.CompareTo(list[oldPos + 1]) < 0))) return oldPos; // No need to move. list.RemoveAt(oldPos);