|
|
@ -76,9 +76,23 @@ namespace Avalonia.Controls.Presenters |
|
|
var firstIndex = ItemCount - panel.Children.Count; |
|
|
var firstIndex = ItemCount - panel.Children.Count; |
|
|
RecycleContainersForMove(firstIndex - FirstIndex); |
|
|
RecycleContainersForMove(firstIndex - FirstIndex); |
|
|
|
|
|
|
|
|
panel.PixelOffset = VirtualizingPanel.ScrollDirection == Orientation.Vertical ? |
|
|
double pixelOffset; |
|
|
panel.Children[0].Bounds.Height : |
|
|
var child = panel.Children[0]; |
|
|
panel.Children[0].Bounds.Width; |
|
|
|
|
|
|
|
|
if (child.IsArrangeValid) |
|
|
|
|
|
{ |
|
|
|
|
|
pixelOffset = VirtualizingPanel.ScrollDirection == Orientation.Vertical ? |
|
|
|
|
|
child.Bounds.Height : |
|
|
|
|
|
child.Bounds.Width; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
pixelOffset = VirtualizingPanel.ScrollDirection == Orientation.Vertical ? |
|
|
|
|
|
child.DesiredSize.Height : |
|
|
|
|
|
child.DesiredSize.Width; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
panel.PixelOffset = pixelOffset; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -402,6 +416,10 @@ namespace Avalonia.Controls.Presenters |
|
|
var panel = VirtualizingPanel; |
|
|
var panel = VirtualizingPanel; |
|
|
var generator = Owner.ItemContainerGenerator; |
|
|
var generator = Owner.ItemContainerGenerator; |
|
|
var selector = Owner.MemberSelector; |
|
|
var selector = Owner.MemberSelector; |
|
|
|
|
|
|
|
|
|
|
|
//validate delta it should never overflow last index or generate index < 0
|
|
|
|
|
|
delta = MathUtilities.Clamp(delta, -FirstIndex, ItemCount - FirstIndex - panel.Children.Count); |
|
|
|
|
|
|
|
|
var sign = delta < 0 ? -1 : 1; |
|
|
var sign = delta < 0 ? -1 : 1; |
|
|
var count = Math.Min(Math.Abs(delta), panel.Children.Count); |
|
|
var count = Math.Min(Math.Abs(delta), panel.Children.Count); |
|
|
var move = count < panel.Children.Count; |
|
|
var move = count < panel.Children.Count; |
|
|
|