瀏覽代碼

Fix selection after initialization.

Fixes first item in menus being selected when menu is shown.
Steven Kirk 6 年之前
父節點
當前提交
60e3c3c977
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/Avalonia.Controls/Primitives/SelectingItemsControl.cs

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

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