Browse Source

add fix for selecting items control.

pull/1763/head
Dan Walmsley 8 years ago
parent
commit
ae4356ef34
  1. 6
      src/Avalonia.Controls/Primitives/SelectingItemsControl.cs

6
src/Avalonia.Controls/Primitives/SelectingItemsControl.cs

@ -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)
{

Loading…
Cancel
Save