فهرست منبع

fixed #3089 now set selecteditem/s before initialization should work properly

Andrey Kunchev 6 سال پیش
والد
کامیت
2e70be023b
1فایلهای تغییر یافته به همراه9 افزوده شده و 3 حذف شده
  1. 9 3
      src/Avalonia.Controls/Primitives/SelectingItemsControl.cs

+ 9 - 3
src/Avalonia.Controls/Primitives/SelectingItemsControl.cs

@@ -1088,9 +1088,15 @@ namespace Avalonia.Controls.Primitives
                 }
                 else
                 {
-                    SelectedIndex = _updateSelectedIndex != int.MinValue ?
-                        _updateSelectedIndex :
-                        AlwaysSelected ? 0 : -1;
+                    if (_updateSelectedIndex != int.MinValue)
+                    {
+                        SelectedIndex = _updateSelectedIndex;
+                    }
+
+                    if (AlwaysSelected && SelectedIndex == -1)
+                    {
+                        SelectedIndex = 0;
+                    }
                 }
             }
         }