1
0
Эх сурвалжийг харах

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

Andrey Kunchev 6 жил өмнө
parent
commit
2e70be023b

+ 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;
+                    }
                 }
             }
         }