|
|
@ -1,3 +1,4 @@ |
|
|
|
|
|
|
|
|
// Copyright (c) The Avalonia Project. All rights reserved.
|
|
|
// Copyright (c) The Avalonia Project. All rights reserved.
|
|
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|
|
|
|
|
|
|
|
@ -470,7 +471,7 @@ namespace Avalonia.Controls |
|
|
if (index > 0) |
|
|
if (index > 0) |
|
|
{ |
|
|
{ |
|
|
var previous = (TreeViewItem)parentGenerator.ContainerFromIndex(index - 1); |
|
|
var previous = (TreeViewItem)parentGenerator.ContainerFromIndex(index - 1); |
|
|
result = previous.IsExpanded ? |
|
|
result = previous.IsExpanded && previous.ItemCount > 0 ? |
|
|
(TreeViewItem)previous.ItemContainerGenerator.ContainerFromIndex(previous.ItemCount - 1) : |
|
|
(TreeViewItem)previous.ItemContainerGenerator.ContainerFromIndex(previous.ItemCount - 1) : |
|
|
previous; |
|
|
previous; |
|
|
} |
|
|
} |
|
|
@ -482,7 +483,7 @@ namespace Avalonia.Controls |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case NavigationDirection.Down: |
|
|
case NavigationDirection.Down: |
|
|
if (from.IsExpanded && intoChildren) |
|
|
if (from.IsExpanded && intoChildren && from.ItemCount > 0) |
|
|
{ |
|
|
{ |
|
|
result = (TreeViewItem)from.ItemContainerGenerator.ContainerFromIndex(0); |
|
|
result = (TreeViewItem)from.ItemContainerGenerator.ContainerFromIndex(0); |
|
|
} |
|
|
} |
|
|
|