diff --git a/src/Files.App/ResourceDictionaries/DefaultGridSplitterStyle.xaml b/src/Files.App/ResourceDictionaries/DefaultGridSplitterStyle.xaml index c685085d1fd3..f069b7ef620c 100644 --- a/src/Files.App/ResourceDictionaries/DefaultGridSplitterStyle.xaml +++ b/src/Files.App/ResourceDictionaries/DefaultGridSplitterStyle.xaml @@ -9,7 +9,7 @@ - + diff --git a/src/Files.App/Views/MainPage.xaml b/src/Files.App/Views/MainPage.xaml index 757be75e9473..3eca3de684cf 100644 --- a/src/Files.App/Views/MainPage.xaml +++ b/src/Files.App/Views/MainPage.xaml @@ -319,6 +319,10 @@ Grid.Column="1" x:Load="{x:Bind ShouldPreviewPaneBeActive, Mode=OneWay}" ManipulationCompleted="PaneSplitter_ManipulationCompleted" + ManipulationStarted="PaneSplitter_ManipulationStarted" + PointerCanceled="PaneSplitter_PointerExited" + PointerEntered="PaneSplitter_PointerEntered" + PointerExited="PaneSplitter_PointerExited" ResizeBehavior="BasedOnAlignment" Style="{StaticResource DefaultGridSplitterStyle}" /> diff --git a/src/Files.App/Views/MainPage.xaml.cs b/src/Files.App/Views/MainPage.xaml.cs index a925c11bd7d7..1d35cb70ee83 100644 --- a/src/Files.App/Views/MainPage.xaml.cs +++ b/src/Files.App/Views/MainPage.xaml.cs @@ -14,6 +14,7 @@ using Files.Backend.Extensions; using Files.Backend.Services.Settings; using Files.Shared.EventArguments; +using Microsoft.UI.Input; using Microsoft.UI.Windowing; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; @@ -25,6 +26,7 @@ using System.Runtime.CompilerServices; using System.Threading.Tasks; using System.Windows.Input; +using UWPToWinAppSDKUpgradeHelpers; using Windows.ApplicationModel; using Windows.Graphics; using Windows.Services.Store; @@ -48,6 +50,12 @@ public MainPageViewModel ViewModel set => DataContext = value; } + + /// + /// True if the user is currently resizing the preview pane + /// + private bool draggingPreviewPane; + public SidebarViewModel SidebarAdaptiveViewModel = new SidebarViewModel(); public OngoingTasksViewModel OngoingTasksViewModel => App.OngoingTasksViewModel; @@ -321,7 +329,7 @@ private void Page_Loaded(object sender, RoutedEventArgs e) return; var totalLaunchCount = SystemInformation.Instance.TotalLaunchCount; - if(totalLaunchCount is 10 or 20 or 30 or 40 or 50) + if (totalLaunchCount is 10 or 20 or 30 or 40 or 50) { // Prompt user to review app in the Store DispatcherQueue.TryEnqueue(async () => await PromptForReview()); @@ -416,6 +424,11 @@ private void UpdatePositioning() } } + private void PaneSplitter_ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e) + { + draggingPreviewPane = true; + } + private void PaneSplitter_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e) { switch (PreviewPane?.Position) @@ -427,6 +440,23 @@ private void PaneSplitter_ManipulationCompleted(object sender, ManipulationCompl UserSettingsService.PreviewPaneSettingsService.HorizontalSizePx = PreviewPane.ActualHeight; break; } + + draggingPreviewPane = false; + } + + private void PaneSplitter_PointerExited(object sender, PointerRoutedEventArgs e) + { + if (draggingPreviewPane) + return; + + var paneSplitter = (GridSplitter)sender; + paneSplitter.ChangeCursor(InputSystemCursor.Create(InputSystemCursorShape.Arrow)); + } + + private void PaneSplitter_PointerEntered(object sender, PointerRoutedEventArgs e) + { + var paneSplitter = (GridSplitter)sender; + paneSplitter.ChangeCursor(InputSystemCursor.Create(InputSystemCursorShape.SizeWestEast)); } public bool ShouldPreviewPaneBeActive => UserSettingsService.PreviewPaneSettingsService.IsEnabled && ShouldPreviewPaneBeDisplayed;