From 109f2a96fac45aca4307ca5fb3960def41e5175b Mon Sep 17 00:00:00 2001 From: hishitetsu <66369541+hishitetsu@users.noreply.github.com> Date: Fri, 21 Jun 2024 23:24:17 +0900 Subject: [PATCH] Fix: Fixed crash that would occur when ungrouping from zoomed out view (#15639) Co-authored-by: Yair <39923744+yaira2@users.noreply.github.com> --- src/Files.App/Views/Layouts/BaseGroupableLayoutPage.cs | 5 ++--- src/Files.App/Views/Layouts/BaseLayoutPage.cs | 6 ++++++ src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs | 2 -- src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs | 2 -- src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs | 2 -- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Files.App/Views/Layouts/BaseGroupableLayoutPage.cs b/src/Files.App/Views/Layouts/BaseGroupableLayoutPage.cs index 8e93fd76628f..00fd11979b84 100644 --- a/src/Files.App/Views/Layouts/BaseGroupableLayoutPage.cs +++ b/src/Files.App/Views/Layouts/BaseGroupableLayoutPage.cs @@ -209,10 +209,9 @@ protected virtual void ItemManipulationModel_StartRenameItemInvoked(object? send StartRenameItem(); } - protected virtual void ZoomIn(object? sender, GroupOption option) + protected override void ZoomIn() { - if (option == GroupOption.None) - RootZoom.IsZoomedInViewActive = true; + RootZoom.IsZoomedInViewActive = true; } protected virtual void FileList_SelectionChanged(object sender, SelectionChangedEventArgs e) diff --git a/src/Files.App/Views/Layouts/BaseLayoutPage.cs b/src/Files.App/Views/Layouts/BaseLayoutPage.cs index 71c993679f35..b6fac9e2a09c 100644 --- a/src/Files.App/Views/Layouts/BaseLayoutPage.cs +++ b/src/Files.App/Views/Layouts/BaseLayoutPage.cs @@ -1314,6 +1314,8 @@ private void UpdateCollectionViewSource() } else { + ZoomIn(); + var newSource = new CollectionViewSource() { IsSourceGrouped = false, @@ -1323,6 +1325,10 @@ private void UpdateCollectionViewSource() } } + protected virtual void ZoomIn() + { + } + protected void SemanticZoom_ViewChangeStarted(object sender, SemanticZoomViewChangedEventArgs e) { if (e.IsSourceZoomedInView) diff --git a/src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs index 145334ba2356..f6f83e16b903 100644 --- a/src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs @@ -149,8 +149,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs) base.OnNavigatedTo(eventArgs); - FolderSettings.GroupOptionPreferenceUpdated -= ZoomIn; - FolderSettings.GroupOptionPreferenceUpdated += ZoomIn; UserSettingsService.LayoutSettingsService.PropertyChanged += LayoutSettingsService_PropertyChanged; SetItemContainerStyle(); diff --git a/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs index 625deb606b17..e2e33723eefd 100644 --- a/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs @@ -159,7 +159,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs) ParentShellPageInstance.FilesystemViewModel.EnabledGitProperties = GetEnabledGitProperties(ColumnsViewModel); FolderSettings.LayoutModeChangeRequested += FolderSettings_LayoutModeChangeRequested; - FolderSettings.GroupOptionPreferenceUpdated += ZoomIn; FolderSettings.SortDirectionPreferenceUpdated += FolderSettings_SortDirectionPreferenceUpdated; FolderSettings.SortOptionPreferenceUpdated += FolderSettings_SortOptionPreferenceUpdated; ParentShellPageInstance.FilesystemViewModel.PageTypeUpdated += FilesystemViewModel_PageTypeUpdated; @@ -186,7 +185,6 @@ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); FolderSettings.LayoutModeChangeRequested -= FolderSettings_LayoutModeChangeRequested; - FolderSettings.GroupOptionPreferenceUpdated -= ZoomIn; FolderSettings.SortDirectionPreferenceUpdated -= FolderSettings_SortDirectionPreferenceUpdated; FolderSettings.SortOptionPreferenceUpdated -= FolderSettings_SortOptionPreferenceUpdated; ParentShellPageInstance.FilesystemViewModel.PageTypeUpdated -= FilesystemViewModel_PageTypeUpdated; diff --git a/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs index 6455b3bfb919..c542d83621c2 100644 --- a/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs @@ -129,8 +129,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs) currentIconSize = FolderSettings.GetRoundedIconSize(); - FolderSettings.GroupOptionPreferenceUpdated -= ZoomIn; - FolderSettings.GroupOptionPreferenceUpdated += ZoomIn; FolderSettings.LayoutModeChangeRequested -= FolderSettings_LayoutModeChangeRequested; FolderSettings.LayoutModeChangeRequested += FolderSettings_LayoutModeChangeRequested; UserSettingsService.LayoutSettingsService.PropertyChanged += LayoutSettingsService_PropertyChanged;