|
|
|
@ -355,6 +355,12 @@ namespace Avalonia.Controls.Primitives |
|
|
|
case NotifyCollectionChangedAction.Replace: |
|
|
|
var selectedIndex = SelectedIndex; |
|
|
|
|
|
|
|
var items = Items?.Cast<object>(); |
|
|
|
if (selectedIndex >= items.Count()) |
|
|
|
{ |
|
|
|
selectedIndex = SelectedIndex = items.Count() - 1; |
|
|
|
} |
|
|
|
|
|
|
|
if (selectedIndex >= e.OldStartingIndex && |
|
|
|
selectedIndex < e.OldStartingIndex + e.OldItems.Count) |
|
|
|
{ |
|
|
|
|