From c489c487013f5d5b96f2e15a5f823450382043e5 Mon Sep 17 00:00:00 2001 From: Tyler Ortiz Date: Wed, 31 Mar 2021 11:13:31 -0700 Subject: [PATCH] Column View improvements (#4397) --- Files/Strings/en-US/Resources.resw | 2 +- Files/Views/ColumnShellPage.xaml.cs | 13 +- Files/Views/LayoutModes/ColumnViewBase.xaml | 142 +----------------- .../Views/LayoutModes/ColumnViewBase.xaml.cs | 30 ++-- .../Views/LayoutModes/ColumnViewBrowser.xaml | 18 +-- .../LayoutModes/ColumnViewBrowser.xaml.cs | 10 +- .../Views/LayoutModes/GenericFileBrowser.xaml | 2 +- Files/Views/LayoutModes/GridViewBrowser.xaml | 2 +- .../Views/LayoutModes/GridViewBrowser.xaml.cs | 2 +- 9 files changed, 34 insertions(+), 187 deletions(-) diff --git a/Files/Strings/en-US/Resources.resw b/Files/Strings/en-US/Resources.resw index 8913a074f20b..4058d6ea8784 100644 --- a/Files/Strings/en-US/Resources.resw +++ b/Files/Strings/en-US/Resources.resw @@ -1953,4 +1953,4 @@ Column View - \ No newline at end of file + diff --git a/Files/Views/ColumnShellPage.xaml.cs b/Files/Views/ColumnShellPage.xaml.cs index b293c489ceb4..2fbd6467acbc 100644 --- a/Files/Views/ColumnShellPage.xaml.cs +++ b/Files/Views/ColumnShellPage.xaml.cs @@ -900,8 +900,7 @@ private async void ItemDisplayFrame_Navigated(object sender, NavigationEventArgs { ContentPage = await GetContentOrNullAsync(); NavigationToolbar.ClearSearchBoxQueryText(true); - if (ItemDisplayFrame.CurrentSourcePageType == typeof(GenericFileBrowser) - || ItemDisplayFrame.CurrentSourcePageType == typeof(GridViewBrowser)) + if (ItemDisplayFrame.CurrentSourcePageType == typeof(ColumnViewBase)) { // Reset DataGrid Rows that may be in "cut" command mode ContentPage.ResetItemOpacity(); @@ -930,7 +929,7 @@ private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, Keybo var alt = args.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Menu); var shift = args.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Shift); var tabInstance = CurrentPageType == typeof(GenericFileBrowser) - || CurrentPageType == typeof(GridViewBrowser); + || CurrentPageType == typeof(GridViewBrowser) || CurrentPageType == typeof(ColumnViewBrowser) || CurrentPageType == typeof(ColumnViewBase); switch (c: ctrl, s: shift, a: alt, t: tabInstance, k: args.KeyboardAccelerator.Key) { @@ -1053,7 +1052,8 @@ await FilesystemHelpers.DeleteItemsAsync( switch (args.KeyboardAccelerator.Key) { case VirtualKey.F2: //F2, rename - if (CurrentPageType == typeof(GenericFileBrowser) || CurrentPageType == typeof(GridViewBrowser)) + if (CurrentPageType == typeof(GenericFileBrowser) || CurrentPageType == typeof(GridViewBrowser) || CurrentPageType == typeof(ColumnViewBrowser) || CurrentPageType == typeof(ColumnViewBase)) + { if (ContentPage.IsItemSelected) { @@ -1340,7 +1340,7 @@ public void NavigateToPath(string navigationPath, Type sourcePageType, Navigatio if (navArgs != null && navArgs.AssociatedTabInstance != null) { ItemDisplayFrame.Navigate( - sourcePageType == null ? typeof(ColumnViewBase) : sourcePageType, + sourcePageType = typeof(ColumnViewBase), navArgs, new SuppressNavigationTransitionInfo()); } @@ -1355,8 +1355,7 @@ public void NavigateToPath(string navigationPath, Type sourcePageType, Navigatio return; } - ItemDisplayFrame.Navigate( - sourcePageType == null ? typeof(ColumnViewBase) : sourcePageType, + ItemDisplayFrame.Navigate(sourcePageType = typeof(ColumnViewBase), new NavigationArguments() { NavPathParam = navigationPath, diff --git a/Files/Views/LayoutModes/ColumnViewBase.xaml b/Files/Views/LayoutModes/ColumnViewBase.xaml index c523dd4dd9ed..563d726db1a8 100644 --- a/Files/Views/LayoutModes/ColumnViewBase.xaml +++ b/Files/Views/LayoutModes/ColumnViewBase.xaml @@ -19,19 +19,7 @@ x:Name="PageRoot" mc:Ignorable="d"> - - - + - - - + + ToolTipService.ToolTip="{x:Bind ItemName, Mode=OneWay}" Loaded="Grid_Loaded"> diff --git a/Files/Views/LayoutModes/ColumnViewBrowser.xaml.cs b/Files/Views/LayoutModes/ColumnViewBrowser.xaml.cs index f2a20e09841d..870c885cc72d 100644 --- a/Files/Views/LayoutModes/ColumnViewBrowser.xaml.cs +++ b/Files/Views/LayoutModes/ColumnViewBrowser.xaml.cs @@ -44,14 +44,15 @@ public sealed partial class ColumnViewBrowser : BaseLayout private ListedItem renamingItem; private string oldItemName; private TextBlock textBlock; + public static IShellPage columnparent; + private NavigationArguments parameters; + private ListViewItem navigatedfolder; public ColumnViewBrowser() : base() { this.InitializeComponent(); ColumnViewBase.ItemInvoked += ColumnViewBase_ItemInvoked; //this.DataContext = this; - //base.BaseLayoutContextFlyout = BaseLayoutContextFlyout; - //base.BaseLayoutItemContextFlyout = BaseLayoutItemContextFlyout; var selectionRectangle = RectangleSelection.Create(FileList, SelectionRectangle, FileList_SelectionChanged); tapDebounceTimer = DispatcherQueue.GetForCurrentThread().CreateTimer(); } @@ -123,7 +124,8 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs) { FileList.ItemsSource = ParentShellPageInstance.FilesystemViewModel.FilesAndFolders; } - var parameters = (NavigationArguments)eventArgs.Parameter; + columnparent = ParentShellPageInstance; + parameters = (NavigationArguments)eventArgs.Parameter; if (parameters.IsLayoutSwitch) { ReloadItemIcons(); @@ -358,7 +360,6 @@ public override void Dispose() private void FileList_SelectionChanged(object sender, SelectionChangedEventArgs e) { - if (e != null) { // Do not commit rename if SelectionChanged is due to selction rectangle (#3660) @@ -421,6 +422,7 @@ private void FileList_PreviewKeyDown(object sender, KeyRoutedEventArgs e) { if (!IsRenamingItem && !ParentShellPageInstance.NavigationToolbar.IsEditModeEnabled) { + if (App.InteractionViewModel.IsQuickLookEnabled) { QuickLookHelpers.ToggleQuickLook(ParentShellPageInstance); diff --git a/Files/Views/LayoutModes/GenericFileBrowser.xaml b/Files/Views/LayoutModes/GenericFileBrowser.xaml index b0650d0930d5..ac49e712fe98 100644 --- a/Files/Views/LayoutModes/GenericFileBrowser.xaml +++ b/Files/Views/LayoutModes/GenericFileBrowser.xaml @@ -421,4 +421,4 @@ StrokeThickness="1" /> - + \ No newline at end of file diff --git a/Files/Views/LayoutModes/GridViewBrowser.xaml b/Files/Views/LayoutModes/GridViewBrowser.xaml index 8c9d226c89be..87528b22efff 100644 --- a/Files/Views/LayoutModes/GridViewBrowser.xaml +++ b/Files/Views/LayoutModes/GridViewBrowser.xaml @@ -31,7 +31,7 @@ x:Key="NegatedBoolToVisibilityConverter" FalseValue="Visible" TrueValue="Collapsed" /> - + diff --git a/Files/Views/LayoutModes/GridViewBrowser.xaml.cs b/Files/Views/LayoutModes/GridViewBrowser.xaml.cs index 775f888aeb40..29c3b2bee4f4 100644 --- a/Files/Views/LayoutModes/GridViewBrowser.xaml.cs +++ b/Files/Views/LayoutModes/GridViewBrowser.xaml.cs @@ -176,7 +176,7 @@ private void StackPanel_RightTapped(object sender, RightTappedRoutedEventArgs e) var parentContainer = DependencyObjectHelpers.FindParent(e.OriginalSource as DependencyObject); if (!parentContainer.IsSelected) { - SetSelectedItemOnUi(FileList.ItemFromContainer(parentContainer) as ListedItem); + SetSelectedItemOnUi(FileList.ItemFromContainer(parentContainer) as ListedItem); } }