Browse Source

Properly reset SelectedIndex after the DataContext changed

pull/3047/head
Benedikt Schroeder 7 years ago
parent
commit
b42126b9e3
  1. 6
      src/Avalonia.Controls/Primitives/SelectingItemsControl.cs

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

@ -1082,7 +1082,11 @@ namespace Avalonia.Controls.Primitives
}
else
{
if (ItemCount > 0)
if (ItemCount == 0 && SelectedIndex != -1)
{
SelectedIndex = -1;
}
else
{
SelectedIndex = _updateSelectedIndex != int.MinValue ? _updateSelectedIndex : 0;
}

Loading…
Cancel
Save