瀏覽代碼

check selectedindex instead of _selectedItem

Dan Walmsley 6 年之前
父節點
當前提交
27e1b9d0f5
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/Avalonia.Controls/Primitives/SelectingItemsControl.cs

+ 1 - 1
src/Avalonia.Controls/Primitives/SelectingItemsControl.cs

@@ -1042,7 +1042,7 @@ namespace Avalonia.Controls.Primitives
                 RaiseEvent(e);
             }
 
-            if (AutoScrollToSelectedItem && _selectedItem != null)
+            if (AutoScrollToSelectedItem && _selectedIndex != -1)
             {
                 ScrollIntoView(_selectedItem);
             }