From 24348a1c9eee582a4802ddee9d7766745dde6c1f Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Thu, 7 Aug 2025 23:39:43 +0900 Subject: [PATCH 1/4] Init --- .../GridSplitter/GridSplitter.Data.cs | 284 +++++++++--------- .../GridSplitter/GridSplitter.Options.cs | 2 +- .../GridSplitter/GripperHoverWrapper.cs | 16 +- src/Files.App/Views/MainPage.xaml | 40 ++- src/Files.App/Views/MainPage.xaml.cs | 40 +-- 5 files changed, 191 insertions(+), 191 deletions(-) diff --git a/src/Files.App.Controls/GridSplitter/GridSplitter.Data.cs b/src/Files.App.Controls/GridSplitter/GridSplitter.Data.cs index 595329fbe3b7..af8123f70a33 100644 --- a/src/Files.App.Controls/GridSplitter/GridSplitter.Data.cs +++ b/src/Files.App.Controls/GridSplitter/GridSplitter.Data.cs @@ -4,153 +4,147 @@ namespace Files.App.Controls { /// - /// Represents the control that redistributes space between columns or rows of a Grid control. + /// Enum to indicate whether GridSplitter resizes Columns or Rows /// - public partial class GridSplitter + public enum GridResizeDirection { /// - /// Enum to indicate whether GridSplitter resizes Columns or Rows - /// - public enum GridResizeDirection - { - /// - /// Determines whether to resize rows or columns based on its Alignment and - /// width compared to height - /// - Auto, - - /// - /// Resize columns when dragging Splitter. - /// - Columns, - - /// - /// Resize rows when dragging Splitter. - /// - Rows - } - - /// - /// Enum to indicate what Columns or Rows the GridSplitter resizes - /// - public enum GridResizeBehavior - { - /// - /// Determine which columns or rows to resize based on its Alignment. - /// - BasedOnAlignment, - - /// - /// Resize the current and next Columns or Rows. - /// - CurrentAndNext, - - /// - /// Resize the previous and current Columns or Rows. - /// - PreviousAndCurrent, - - /// - /// Resize the previous and next Columns or Rows. - /// - PreviousAndNext - } - - /// - /// Enum to indicate the supported gripper cursor types. - /// - public enum GripperCursorType - { - /// - /// Change the cursor based on the splitter direction - /// - Default = -1, - - /// - /// Standard Arrow cursor - /// - Arrow, - - /// - /// Standard Cross cursor - /// - Cross, - - /// - /// Standard Custom cursor - /// - Custom, - - /// - /// Standard Hand cursor - /// - Hand, - - /// - /// Standard Help cursor - /// - Help, - - /// - /// Standard IBeam cursor - /// - IBeam, - - /// - /// Standard SizeAll cursor - /// - SizeAll, - - /// - /// Standard SizeNortheastSouthwest cursor - /// - SizeNortheastSouthwest, - - /// - /// Standard SizeNorthSouth cursor - /// - SizeNorthSouth, - - /// - /// Standard SizeNorthwestSoutheast cursor - /// - SizeNorthwestSoutheast, - - /// - /// Standard SizeWestEast cursor - /// - SizeWestEast, - - /// - /// Standard UniversalNo cursor - /// - UniversalNo, - - /// - /// Standard UpArrow cursor - /// - UpArrow, - - /// - /// Standard Wait cursor - /// - Wait - } - - /// - /// Enum to indicate the behavior of window cursor on grid splitter hover - /// - public enum SplitterCursorBehavior - { - /// - /// Update window cursor on Grid Splitter hover - /// - ChangeOnSplitterHover, - - /// - /// Update window cursor on Grid Splitter Gripper hover - /// - ChangeOnGripperHover - } + /// Determines whether to resize rows or columns based on its Alignment and + /// width compared to height + /// + Auto, + + /// + /// Resize columns when dragging Splitter. + /// + Columns, + + /// + /// Resize rows when dragging Splitter. + /// + Rows + } + + /// + /// Enum to indicate what Columns or Rows the GridSplitter resizes + /// + public enum GridResizeBehavior + { + /// + /// Determine which columns or rows to resize based on its Alignment. + /// + BasedOnAlignment, + + /// + /// Resize the current and next Columns or Rows. + /// + CurrentAndNext, + + /// + /// Resize the previous and current Columns or Rows. + /// + PreviousAndCurrent, + + /// + /// Resize the previous and next Columns or Rows. + /// + PreviousAndNext + } + + /// + /// Enum to indicate the supported gripper cursor types. + /// + public enum GripperCursorType + { + /// + /// Change the cursor based on the splitter direction + /// + Default = -1, + + /// + /// Standard Arrow cursor + /// + Arrow, + + /// + /// Standard Cross cursor + /// + Cross, + + /// + /// Standard Custom cursor + /// + Custom, + + /// + /// Standard Hand cursor + /// + Hand, + + /// + /// Standard Help cursor + /// + Help, + + /// + /// Standard IBeam cursor + /// + IBeam, + + /// + /// Standard SizeAll cursor + /// + SizeAll, + + /// + /// Standard SizeNortheastSouthwest cursor + /// + SizeNortheastSouthwest, + + /// + /// Standard SizeNorthSouth cursor + /// + SizeNorthSouth, + + /// + /// Standard SizeNorthwestSoutheast cursor + /// + SizeNorthwestSoutheast, + + /// + /// Standard SizeWestEast cursor + /// + SizeWestEast, + + /// + /// Standard UniversalNo cursor + /// + UniversalNo, + + /// + /// Standard UpArrow cursor + /// + UpArrow, + + /// + /// Standard Wait cursor + /// + Wait + } + + /// + /// Enum to indicate the behavior of window cursor on grid splitter hover + /// + public enum SplitterCursorBehavior + { + /// + /// Update window cursor on Grid Splitter hover + /// + ChangeOnSplitterHover, + + /// + /// Update window cursor on Grid Splitter Gripper hover + /// + ChangeOnGripperHover } } diff --git a/src/Files.App.Controls/GridSplitter/GridSplitter.Options.cs b/src/Files.App.Controls/GridSplitter/GridSplitter.Options.cs index c3f5bbab84f2..3035b90c44e1 100644 --- a/src/Files.App.Controls/GridSplitter/GridSplitter.Options.cs +++ b/src/Files.App.Controls/GridSplitter/GridSplitter.Options.cs @@ -67,7 +67,7 @@ public static readonly DependencyProperty ParentLevelProperty public static readonly DependencyProperty GripperCursorProperty = DependencyProperty.RegisterAttached( nameof(GripperCursor), - typeof(InputSystemCursorShape?), + typeof(GripperCursorType), typeof(GridSplitter), new PropertyMetadata(GripperCursorType.Default, OnGripperCursorPropertyChanged)); diff --git a/src/Files.App.Controls/GridSplitter/GripperHoverWrapper.cs b/src/Files.App.Controls/GridSplitter/GripperHoverWrapper.cs index 99e8579595e9..69f02cd5a440 100644 --- a/src/Files.App.Controls/GridSplitter/GripperHoverWrapper.cs +++ b/src/Files.App.Controls/GridSplitter/GripperHoverWrapper.cs @@ -8,16 +8,16 @@ namespace Files.App.Controls { internal class GripperHoverWrapper { - private readonly GridSplitter.GridResizeDirection _gridSplitterDirection; + private readonly GridResizeDirection _gridSplitterDirection; private InputCursor _splitterPreviousPointer; private InputCursor _previousCursor; - private GridSplitter.GripperCursorType _gripperCursor; + private GripperCursorType _gripperCursor; private int _gripperCustomCursorResource; private bool _isDragging; private UIElement _element; - internal GridSplitter.GripperCursorType GripperCursor + internal GripperCursorType GripperCursor { get { @@ -50,7 +50,7 @@ internal int GripperCustomCursorResource /// GridSplitter resize direction /// GridSplitter gripper on hover cursor type /// GridSplitter gripper custom cursor resource number - internal GripperHoverWrapper(UIElement element, GridSplitter.GridResizeDirection gridSplitterDirection, GridSplitter.GripperCursorType gripperCursor, int gripperCustomCursorResource) + internal GripperHoverWrapper(UIElement element, GridResizeDirection gridSplitterDirection, GripperCursorType gripperCursor, int gripperCustomCursorResource) { _gridSplitterDirection = gridSplitterDirection; _gripperCursor = gripperCursor; @@ -113,13 +113,13 @@ private void UpdateDisplayCursor() return; } - if (_gripperCursor == GridSplitter.GripperCursorType.Default) + if (_gripperCursor == GripperCursorType.Default) { - if (_gridSplitterDirection == GridSplitter.GridResizeDirection.Columns) + if (_gridSplitterDirection == GridResizeDirection.Columns) { // Window.Current.CoreWindow.PointerCursor = GridSplitter.ColumnsSplitterCursor; } - else if (_gridSplitterDirection == GridSplitter.GridResizeDirection.Rows) + else if (_gridSplitterDirection == GridResizeDirection.Rows) { // Window.Current.CoreWindow.PointerCursor = GridSplitter.RowSplitterCursor; } @@ -127,7 +127,7 @@ private void UpdateDisplayCursor() else { var inputSystemCursorShape = (InputSystemCursorShape)((int)_gripperCursor); - if (_gripperCursor == GridSplitter.GripperCursorType.Custom) + if (_gripperCursor == GripperCursorType.Custom) { if (_gripperCustomCursorResource > GridSplitter.GripperCustomCursorDefaultResource) { diff --git a/src/Files.App/Views/MainPage.xaml b/src/Files.App/Views/MainPage.xaml index 73587546e8e5..347284dc4e3c 100644 --- a/src/Files.App/Views/MainPage.xaml +++ b/src/Files.App/Views/MainPage.xaml @@ -432,7 +432,7 @@ - + @@ -448,6 +448,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Files.App/Views/MainPage.xaml.cs b/src/Files.App/Views/MainPage.xaml.cs index 6f694cad775e..67db61be7ba6 100644 --- a/src/Files.App/Views/MainPage.xaml.cs +++ b/src/Files.App/Views/MainPage.xaml.cs @@ -330,12 +330,7 @@ private void UpdatePositioning() { if (InfoPane is null || !ViewModel.ShouldPreviewPaneBeActive) { - PaneRow.MinHeight = 0; - PaneRow.MaxHeight = double.MaxValue; - PaneRow.Height = new GridLength(0); - PaneColumn.MinWidth = 0; - PaneColumn.MaxWidth = double.MaxValue; - PaneColumn.Width = new GridLength(0); + VisualStateManager.GoToState(this, "InfoPanePositionNone", true); } else { @@ -343,42 +338,15 @@ private void UpdatePositioning() switch (InfoPane.Position) { case PreviewPanePositions.None: - PaneRow.MinHeight = 0; - PaneRow.Height = new GridLength(0); - PaneColumn.MinWidth = 0; - PaneColumn.Width = new GridLength(0); + VisualStateManager.GoToState(this, "InfoPanePositionNone", true); break; case PreviewPanePositions.Right: - InfoPane.SetValue(Grid.RowProperty, 1); - InfoPane.SetValue(Grid.ColumnProperty, 2); - PaneSplitter.SetValue(Grid.RowProperty, 1); - PaneSplitter.SetValue(Grid.ColumnProperty, 1); - PaneSplitter.Width = 2; - PaneSplitter.Height = RootGrid.ActualHeight; - PaneSplitter.GripperCursor = GridSplitter.GripperCursorType.SizeWestEast; PaneSplitter.ChangeCursor(InputSystemCursor.Create(InputSystemCursorShape.SizeWestEast)); - PaneColumn.MinWidth = InfoPane.MinWidth; - PaneColumn.MaxWidth = InfoPane.MaxWidth; - PaneColumn.Width = new GridLength(UserSettingsService.InfoPaneSettingsService.VerticalSizePx, GridUnitType.Pixel); - PaneRow.MinHeight = 0; - PaneRow.MaxHeight = double.MaxValue; - PaneRow.Height = new GridLength(0); + VisualStateManager.GoToState(this, "InfoPanePositionRight", true); break; case PreviewPanePositions.Bottom: - InfoPane.SetValue(Grid.RowProperty, 3); - InfoPane.SetValue(Grid.ColumnProperty, 0); - PaneSplitter.SetValue(Grid.RowProperty, 2); - PaneSplitter.SetValue(Grid.ColumnProperty, 0); - PaneSplitter.Height = 2; - PaneSplitter.Width = RootGrid.ActualWidth; - PaneSplitter.GripperCursor = GridSplitter.GripperCursorType.SizeNorthSouth; PaneSplitter.ChangeCursor(InputSystemCursor.Create(InputSystemCursorShape.SizeNorthSouth)); - PaneColumn.MinWidth = 0; - PaneColumn.MaxWidth = double.MaxValue; - PaneColumn.Width = new GridLength(0); - PaneRow.MinHeight = InfoPane.MinHeight; - PaneRow.MaxHeight = InfoPane.MaxHeight; - PaneRow.Height = new GridLength(UserSettingsService.InfoPaneSettingsService.HorizontalSizePx, GridUnitType.Pixel); + VisualStateManager.GoToState(this, "InfoPanePositionBottom", true); break; } } From 7a1f7d9f99141b470a087c1c024ecf417982d8f6 Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Thu, 7 Aug 2025 23:45:54 +0900 Subject: [PATCH 2/4] Update --- src/Files.App/Views/MainPage.xaml.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Files.App/Views/MainPage.xaml.cs b/src/Files.App/Views/MainPage.xaml.cs index 67db61be7ba6..dea9c1b6a955 100644 --- a/src/Files.App/Views/MainPage.xaml.cs +++ b/src/Files.App/Views/MainPage.xaml.cs @@ -322,10 +322,6 @@ private void SidebarControl_Loaded(object sender, RoutedEventArgs e) private void RootGrid_SizeChanged(object sender, SizeChangedEventArgs e) => LoadPaneChanged(); - /// - /// Call this function to update the positioning of the preview pane. - /// This is a workaround as the VisualStateManager causes problems. - /// private void UpdatePositioning() { if (InfoPane is null || !ViewModel.ShouldPreviewPaneBeActive) From 5eb5d7284860d45162d2b15ce35521531c86e4fc Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Tue, 12 Aug 2025 04:35:26 +0900 Subject: [PATCH 3/4] Req --- src/Files.App/Views/MainPage.xaml | 46 +++++++++++++++------------- src/Files.App/Views/MainPage.xaml.cs | 4 +-- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/Files.App/Views/MainPage.xaml b/src/Files.App/Views/MainPage.xaml index 347284dc4e3c..8661673c530d 100644 --- a/src/Files.App/Views/MainPage.xaml +++ b/src/Files.App/Views/MainPage.xaml @@ -198,7 +198,7 @@ Height="*" MinHeight="100" /> - + @@ -207,7 +207,7 @@ Width="*" MinWidth="208" /> - + @@ -232,9 +232,9 @@ HorizontalContentAlignment="Stretch" Content="{x:Bind ViewModel.SelectedTabItem.ContentFrame, Mode=OneWay}" /> - + - - - - + + + + - - - - - - - + + + + + + + + - - - - - - - + + + + + + + + diff --git a/src/Files.App/Views/MainPage.xaml.cs b/src/Files.App/Views/MainPage.xaml.cs index dea9c1b6a955..41d4b1151354 100644 --- a/src/Files.App/Views/MainPage.xaml.cs +++ b/src/Files.App/Views/MainPage.xaml.cs @@ -337,11 +337,11 @@ private void UpdatePositioning() VisualStateManager.GoToState(this, "InfoPanePositionNone", true); break; case PreviewPanePositions.Right: - PaneSplitter.ChangeCursor(InputSystemCursor.Create(InputSystemCursorShape.SizeWestEast)); + InfoPaneSizer.ChangeCursor(InputSystemCursor.Create(InputSystemCursorShape.SizeWestEast)); VisualStateManager.GoToState(this, "InfoPanePositionRight", true); break; case PreviewPanePositions.Bottom: - PaneSplitter.ChangeCursor(InputSystemCursor.Create(InputSystemCursorShape.SizeNorthSouth)); + InfoPaneSizer.ChangeCursor(InputSystemCursor.Create(InputSystemCursorShape.SizeNorthSouth)); VisualStateManager.GoToState(this, "InfoPanePositionBottom", true); break; } From de12090c97ffc9fe1d00da83b4ab6fd7c35efecd Mon Sep 17 00:00:00 2001 From: 0x5BFA <62196528+0x5bfa@users.noreply.github.com> Date: Wed, 20 Aug 2025 05:43:58 +0900 Subject: [PATCH 4/4] Req --- src/Files.App/Views/MainPage.xaml | 2 -- src/Files.App/Views/MainPage.xaml.cs | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Files.App/Views/MainPage.xaml b/src/Files.App/Views/MainPage.xaml index 8661673c530d..0ca12c9b6acb 100644 --- a/src/Files.App/Views/MainPage.xaml +++ b/src/Files.App/Views/MainPage.xaml @@ -466,7 +466,6 @@ - @@ -483,7 +482,6 @@ - diff --git a/src/Files.App/Views/MainPage.xaml.cs b/src/Files.App/Views/MainPage.xaml.cs index 41d4b1151354..472cb76ab19c 100644 --- a/src/Files.App/Views/MainPage.xaml.cs +++ b/src/Files.App/Views/MainPage.xaml.cs @@ -338,10 +338,12 @@ private void UpdatePositioning() break; case PreviewPanePositions.Right: InfoPaneSizer.ChangeCursor(InputSystemCursor.Create(InputSystemCursorShape.SizeWestEast)); + InfoPaneColumnDefinition.Width = new(UserSettingsService.InfoPaneSettingsService.VerticalSizePx); VisualStateManager.GoToState(this, "InfoPanePositionRight", true); break; case PreviewPanePositions.Bottom: InfoPaneSizer.ChangeCursor(InputSystemCursor.Create(InputSystemCursorShape.SizeNorthSouth)); + InfoPaneRowDefinition.Height = new(UserSettingsService.InfoPaneSettingsService.HorizontalSizePx); VisualStateManager.GoToState(this, "InfoPanePositionBottom", true); break; }