|
|
@@ -304,6 +304,11 @@ namespace Avalonia.Controls.Primitives
|
|
|
{
|
|
|
base.ItemsCollectionChanged(sender, e);
|
|
|
|
|
|
+ if (_updateCount > 0)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
switch (e.Action)
|
|
|
{
|
|
|
case NotifyCollectionChangedAction.Add:
|
|
|
@@ -1071,13 +1076,16 @@ namespace Avalonia.Controls.Primitives
|
|
|
|
|
|
private void UpdateFinished()
|
|
|
{
|
|
|
- if (_updateSelectedIndex != int.MinValue)
|
|
|
+ if (_updateSelectedItem != null)
|
|
|
{
|
|
|
- SelectedIndex = _updateSelectedIndex;
|
|
|
+ SelectedItem = _updateSelectedItem;
|
|
|
}
|
|
|
- else if (_updateSelectedItem != null)
|
|
|
+ else
|
|
|
{
|
|
|
- SelectedItem = _updateSelectedItem;
|
|
|
+ if (ItemCount > 0)
|
|
|
+ {
|
|
|
+ SelectedIndex = _updateSelectedIndex != int.MinValue ? _updateSelectedIndex : 0;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|