From 3b129b11288614f836c0284b5fcb2d9bfe37a4a9 Mon Sep 17 00:00:00 2001 From: Dong Bin Date: Tue, 25 Feb 2025 01:22:24 +0800 Subject: [PATCH] fix: translate to panel root. --- src/Ursa/Controls/SelectionList/SelectionList.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Ursa/Controls/SelectionList/SelectionList.cs b/src/Ursa/Controls/SelectionList/SelectionList.cs index 1226032..cbce4ea 100644 --- a/src/Ursa/Controls/SelectionList/SelectionList.cs +++ b/src/Ursa/Controls/SelectionList/SelectionList.cs @@ -58,7 +58,7 @@ public class SelectionList: SelectingItemsControl } OpacityProperty.SetValue(1d, _indicator); InvalidateMeasure(); - InvalidateArrange(); + // InvalidateArrange(); } protected override Size ArrangeOverride(Size finalSize) @@ -68,7 +68,12 @@ public class SelectionList: SelectingItemsControl { var container = ContainerFromItem(SelectedItem); if (container is null) return size; - _indicator.Arrange(container.Bounds); + var bounds = container.Bounds; + if (ItemsPanelRoot?.Bounds.Position is { } p) + { + bounds = bounds.Translate(p); + } + _indicator.Arrange(bounds); } else { @@ -103,7 +108,12 @@ public class SelectionList: SelectingItemsControl var container = ContainerFromItem(SelectedItem); if (container is null) return; _indicator.Opacity = 1; - _indicator.Arrange(container.Bounds); + var bounds = container.Bounds; + if (ItemsPanelRoot?.Bounds.Position is { } p) + { + bounds = bounds.Translate(p); + } + _indicator.Arrange(bounds); } }