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

#2355 Direct access for treeview index values when select all.

MonkAlex 6 жил өмнө
parent
commit
33a6ae8215

+ 5 - 0
src/Avalonia.Controls/Generators/TreeContainerIndex.cs

@@ -36,6 +36,11 @@ namespace Avalonia.Controls.Generators
         /// </summary>
         public IEnumerable<IControl> Items => _containerToItem.Keys;
 
+        /// <summary>
+        /// Gets the items of currently materialized containers.
+        /// </summary>
+        public IEnumerable<object> Objects => _containerToItem.Values;
+
         /// <summary>
         /// Adds an entry to the index.
         /// </summary>

+ 1 - 2
src/Avalonia.Controls/TreeView.cs

@@ -411,8 +411,7 @@ namespace Avalonia.Controls
 
                 if (this.SelectionMode == SelectionMode.Multiple && Match(keymap.SelectAll))
                 {
-                    var allVisibleItems = ItemContainerGenerator.Index.Items.Select(ItemContainerGenerator.Index.ItemFromContainer);
-                    SelectingItemsControl.SynchronizeItems(SelectedItems, allVisibleItems);
+                    SelectingItemsControl.SynchronizeItems(SelectedItems, ItemContainerGenerator.Index.Objects);
                     e.Handled = true;
                 }
             }