From 53639c227083b8e21e53a81d8733869bec4ee811 Mon Sep 17 00:00:00 2001 From: hishitetsu <66369541+hishitetsu@users.noreply.github.com> Date: Fri, 21 Jul 2023 17:03:13 +0900 Subject: [PATCH] Honor dual pane settings --- src/Files.App/MainWindow.xaml.cs | 2 ++ src/Files.App/Views/PaneHolderPage.xaml.cs | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Files.App/MainWindow.xaml.cs b/src/Files.App/MainWindow.xaml.cs index 534f7cb7dc5c..bed178f48d13 100644 --- a/src/Files.App/MainWindow.xaml.cs +++ b/src/Files.App/MainWindow.xaml.cs @@ -207,10 +207,12 @@ async Task PerformNavigation(string payload, string selectItem = null) payload = folder.Path; // Convert short name to long name (#6190) } + var generalSettingsService = Ioc.Default.GetService(); var paneNavigationArgs = new PaneNavigationArguments { LeftPaneNavPathParam = payload, LeftPaneSelectItemParam = selectItem, + RightPaneNavPathParam = Bounds.Width > PaneHolderPage.DualPaneWidthThreshold && (generalSettingsService?.AlwaysOpenDualPaneInNewTab ?? false) ? "Home" : null, }; if (rootFrame.Content is not null) diff --git a/src/Files.App/Views/PaneHolderPage.xaml.cs b/src/Files.App/Views/PaneHolderPage.xaml.cs index 52867dbd0d96..1a679e476537 100644 --- a/src/Files.App/Views/PaneHolderPage.xaml.cs +++ b/src/Files.App/Views/PaneHolderPage.xaml.cs @@ -14,6 +14,8 @@ namespace Files.App.Views { public sealed partial class PaneHolderPage : Page, IPaneHolder, ITabItemContent { + public static readonly int DualPaneWidthThreshold = 750; + public static event EventHandler? CurrentInstanceChanged; private IUserSettingsService UserSettingsService { get; } @@ -46,7 +48,7 @@ public TabItemArguments TabItemArguments } } - private bool _WindowIsCompact = MainWindow.Instance.Bounds.Width <= 750; + private bool _WindowIsCompact = MainWindow.Instance.Bounds.Width <= DualPaneWidthThreshold; public bool WindowIsCompact { get => _WindowIsCompact; @@ -78,7 +80,7 @@ public bool IsMultiPaneActive => IsRightPaneVisible; public bool IsMultiPaneEnabled - => !(MainWindow.Instance.Bounds.Width <= 750); + => MainWindow.Instance.Bounds.Width > DualPaneWidthThreshold; private NavigationParams _NavParamsLeft; public NavigationParams NavParamsLeft @@ -208,7 +210,7 @@ public PaneHolderPage() private void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e) { - WindowIsCompact = MainWindow.Instance.Bounds.Width <= 750; + WindowIsCompact = MainWindow.Instance.Bounds.Width <= DualPaneWidthThreshold; } protected override void OnNavigatedTo(NavigationEventArgs eventArgs)