diff --git a/src/Files.App.Controls/BladeView/BladeView.cs b/src/Files.App.Controls/BladeView/BladeView.cs index ba3535f73677..57794b3f08f2 100644 --- a/src/Files.App.Controls/BladeView/BladeView.cs +++ b/src/Files.App.Controls/BladeView/BladeView.cs @@ -150,6 +150,17 @@ private ScrollViewer GetScrollViewer() return _scrollViewer ?? (_scrollViewer = this.FindDescendant()); } + public void ScrollToEnd() + { + LayoutUpdated += OnLayoutUpdatedScrollToEnd; + } + + private void OnLayoutUpdatedScrollToEnd(object sender, object e) + { + LayoutUpdated -= OnLayoutUpdatedScrollToEnd; + GetScrollViewer()?.ChangeView(_scrollViewer.ScrollableWidth, null, null, false); + } + private void AdjustBladeItemSize() { // Adjust blade items to be full screen @@ -182,7 +193,8 @@ private void ItemsVectorChanged(IObservableVector sender, IVectorChanged else if (e.CollectionChange == CollectionChange.ItemInserted) { UpdateLayout(); - GetScrollViewer()?.ChangeView(_scrollViewer.ScrollableWidth, null, null); + // The following line doesn't work as expected due to the items not being fully loaded yet and thus the scrollable width not being accurate. + //GetScrollViewer()?.ChangeView(_scrollViewer.ScrollableWidth, null, null); } } } diff --git a/src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs index aca77854ee60..ea1989230cda 100644 --- a/src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/ColumnsLayoutPage.xaml.cs @@ -89,6 +89,8 @@ public void SetWidth(int index) var blade = activeBlades[index]; blade?.SetWidth(); + + ColumnHost.ScrollToEnd(); } private void ContentChanged(IShellPage p)