Crunch those numbers
This commit is contained in:
@@ -509,16 +509,9 @@ public partial class ObservableCollection<TItem> :
|
|||||||
|
|
||||||
if (item.Equals(SelectedItem))
|
if (item.Equals(SelectedItem))
|
||||||
{
|
{
|
||||||
if (index <= Count - 1)
|
int newIndex = Math.Min(index, Count - 1);
|
||||||
{
|
TItem? selectedItem = newIndex >= 0 ? this[newIndex] : default;
|
||||||
TItem selectedItem = this[index];
|
dispatcher.Invoke(() => SelectedItem = selectedItem);
|
||||||
dispatcher.Invoke(() => SelectedItem = selectedItem);
|
|
||||||
}
|
|
||||||
else if (index - 1 >= 0)
|
|
||||||
{
|
|
||||||
TItem selectedItem = this[index - 1];
|
|
||||||
dispatcher.Invoke(() => SelectedItem = selectedItem);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user