Browse Source

#2355 'Select all' support TreeView too, only visible part of tree.

pull/2356/head
MonkAlex 8 years ago
parent
commit
57dcfadf57
  1. 14
      src/Avalonia.Controls/TreeView.cs

14
src/Avalonia.Controls/TreeView.cs

@ -10,6 +10,7 @@ using Avalonia.Collections;
using Avalonia.Controls.Generators;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Input.Platform;
using Avalonia.Interactivity;
using Avalonia.Threading;
using Avalonia.VisualTree;
@ -402,6 +403,19 @@ namespace Avalonia.Controls
SelectedItem = ElementAt(Items, 0);
}
}
if (!e.Handled)
{
var keymap = AvaloniaLocator.Current.GetService<PlatformHotkeyConfiguration>();
bool Match(List<KeyGesture> gestures) => gestures.Any(g => g.Matches(e));
if (this.SelectionMode == SelectionMode.Multiple && Match(keymap.SelectAll))
{
var allVisibleItems = ItemContainerGenerator.Index.Items.Select(ItemContainerGenerator.Index.ItemFromContainer);
SelectingItemsControl.SynchronizeItems(SelectedItems, allVisibleItems);
e.Handled = true;
}
}
}
private TreeViewItem GetContainerInDirection(

Loading…
Cancel
Save