From 33a6ae8215ce81b45d95cd0b6254b969aabd4ee0 Mon Sep 17 00:00:00 2001 From: MonkAlex <3amepob@gmail.com> Date: Sun, 10 Mar 2019 00:55:29 +0400 Subject: [PATCH] #2355 Direct access for treeview index values when select all. --- src/Avalonia.Controls/Generators/TreeContainerIndex.cs | 5 +++++ src/Avalonia.Controls/TreeView.cs | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/Generators/TreeContainerIndex.cs b/src/Avalonia.Controls/Generators/TreeContainerIndex.cs index 24b3fc1f32..0a65dd9ff1 100644 --- a/src/Avalonia.Controls/Generators/TreeContainerIndex.cs +++ b/src/Avalonia.Controls/Generators/TreeContainerIndex.cs @@ -36,6 +36,11 @@ namespace Avalonia.Controls.Generators /// public IEnumerable Items => _containerToItem.Keys; + /// + /// Gets the items of currently materialized containers. + /// + public IEnumerable Objects => _containerToItem.Values; + /// /// Adds an entry to the index. /// diff --git a/src/Avalonia.Controls/TreeView.cs b/src/Avalonia.Controls/TreeView.cs index 141a151bdb..abd9bc4232 100644 --- a/src/Avalonia.Controls/TreeView.cs +++ b/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; } }