From c91863f46a5fdba6a553ba17e5f7ebc8cde4c291 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 7 Feb 2020 10:01:52 +0100 Subject: [PATCH] Correctly handle scrolling in TreeView. --- src/Avalonia.Controls/TreeView.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Avalonia.Controls/TreeView.cs b/src/Avalonia.Controls/TreeView.cs index 43c1e62d74..93c662e965 100644 --- a/src/Avalonia.Controls/TreeView.cs +++ b/src/Avalonia.Controls/TreeView.cs @@ -323,13 +323,8 @@ namespace Avalonia.Controls { if (e.PropertyName == nameof(SelectionModel.AnchorIndex)) { - var index = Selection.AnchorIndex.GetSize() > 0 ? Selection.AnchorIndex.GetAt(0) : -1; - var item = index != -1 ? ElementAt(Items, index) : null; - - if (item != null) - { - //ScrollIntoView(item); - } + var container = ContainerFromIndex(Selection.AnchorIndex); + container?.BringIntoView(); } }